I have a scenario where my data-model is XML and I have to generate a
JSP from this based on a template. This XML is not as simple as the Book.xml discussed in the examples of Freemarker.
Now I am stuck with how to get the attributes, Say I have the XML:
<book>
<title>
Test Book</title>
<chapter title="Chapter 1" pages="2">
<para title="First Para" weight="1" align="Left">p1.1</para>
<para title="Second Para" weight="3">p1.2</para>
<para title="Third Para" weight="2" >p1.3</para>
</chapter>
</book>
In this case the Nodes have "attributes" some are not mandatory (may be there or may not be), what I mean to say is that the number of attributes for an element is not fixed.
When I display the ${.node?node_type} I always see the type as "element", the attributes are not traversed. I know I must be doing something stupid (I do not have any experience with XSLT etc). I was not able to locate a solution at the docs.
Can anybody help me with this? A pointer to some existing resource would also help a lot. Thanks for your time.
Regards,
[ February 01, 2005: Message edited by: Yash Sharma ]