Keshava

I don't know enough about XSL/XSLT to tell you how you can do this. Maybe you could transform your XML document using XSL and then manipulate that in Velocity using the ideas I gave you earlier.

Eric

Keshava Murthy wrote:
Eric,

I also want you to know that the contents of XML file is generated
dynamically from user interface and xml content is not known.

I will just brief you about the application-

The application is for developing a lab note book wherein the users will
create their own protocols. The protocol is entered in UI. The HTML
docuement is to be converted to  XML document(template) and later the XML
document is to be displayed to the user in proper layout using xsl with data
populated from database tables. All these things has happen dynamically.

regards,
Keshava Murthy. S


----- Original Message ----- From: "Keshava Murthy" <[EMAIL PROTECTED]> To: "Turbine Users List" <[EMAIL PROTECTED]> Sent: Saturday, June 14, 2003 1:00 PM Subject: Re: Generating VM from XML file dynamically



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]





--------------------------------------------------------------------- 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]



Reply via email to