You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by satheeshsamiappan <cs...@gmail.com> on 2009/09/16 09:22:25 UTC
populating template using xml
Hi all,
I have a scenario where i need to load a template based on a XML file. I was
able to load it using the vm template.
Now i need to use xpath expression to get a section of xml document. Is
there a way to fetch portion of xml document using xpath expression.
I tried anakia, but still it is teasing.
eg:
#set ($studentList = $xpath.applyTo("document/student", $root))
#foreach( $student in $studentList)
$student
#end
When i use the above code in my vm template i'm able to get only the end
nodes and not the values.
o/p:
[Element: <student/>]
[Element: <student/>]
[Element: <student/>]
without using xpath expression i'm able to get the desired o/p.
my xml file looks like this
<document>
<student>
<rno>1</rno>
<name>Komal</name>
<marks>
<mark>80</mark>
<mark>90</mark>
</marks>
</student>
...
...
<document>
--
View this message in context: http://www.nabble.com/populating-template-using-xml-tp25467258p25467258.html
Sent from the Velocity - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org