Eric,
Thanks for the code. But how do I transform the XML using xsl. Unless this
is done the layout will not be proper.
regards,
Keshava Murthy. S
----- Original Message -----
From: "Eric Emminger" <[EMAIL PROTECTED]>
To: "Turbine Users List" <[EMAIL PROTECTED]>
Sent: Saturday, June 14, 2003 3:42 AM
Subject: Re: Generating VM from XML file dynamically
> 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]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]