Keshava

I was able to convert XML to VM file using turbine's  TurbineXSLTService.
The Screen class code, xml and xsl file ares in the attached docuemnts.
However I have no idea how I can populate the components when VM file is
displayed. I would like to take the approach you sugeested but I have not
used DOM4J before, can you send me sample code how to go about.

I suggest using a pull tool. Create a method that returns a Document using the following code with DOM4J.


public Document getDocument() {
// get the actual xml file; this is just an example
File file = new File("protocol.xml");
SAXReader reader = new SAXReader();
Document doc = reader.read(file);
return doc;
}

Create another method that returns a List of dates from the database.

public List getDateList(String table, String column, String where) {
// create an SQL statement from table, column, and where
}

In your VM template, do this.

#set($doc = $pullTool.getDocument())
#set($date = $doc.selectNodes("/protocol/materials/solution/date"))
#set($table = $date.valueOf("@table"))
## set $column
## set $where
<select name="select" size="10" multiple="true" style="width:150px;">
#foreach($option in $pullTool.getDateList($table, $column, $where))
    <option>$option</option>
#end
</select>


Eric



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to