I have a XML file that look kind of lilke this:
<list>
<Prog id ="p00001">
<InstID>123</InstID>
</Prog>
<Prog id ="p00002">
<InstID>456</InstID>
</Prog>
</list>
In my HTML documents I'm using tables to display the data from the XML. How can I bind the data for each page to a specific Prog id?
I was trying to avoid anything server-side but the Data Island binding w/ HTML/XML binds the entire xml file and all the data in it, you can specify a child element by ID to display which causes all the data to display on each page.
sbouso
0 Points
1 Post
Retrieve XML data by child id and display in HTML table
May 11, 2007 04:31 PM|LINK
I have a XML file that look kind of lilke this:
<list>
<Prog id ="p00001">
<InstID>123</InstID>
</Prog>
<Prog id ="p00002">
<InstID>456</InstID>
</Prog>
</list>
In my HTML documents I'm using tables to display the data from the XML. How can I bind the data for each page to a specific Prog id?
I was trying to avoid anything server-side but the Data Island binding w/ HTML/XML binds the entire xml file and all the data in it, you can specify a child element by ID to display which causes all the data to display on each page.
Any ideas?
Thanks
AshokRaja
Contributor
2674 Points
478 Posts
Re: Retrieve XML data by child id and display in HTML table
May 14, 2007 08:52 AM|LINK
Use XSL to Filter your Out put.
The XSLT
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><
xsl:template match="/"><
html><
body><
table border="1"><
tr bgcolor="green"><
th>Inst ID</th></
tr><
xsl:for-each select="list/Prog[@id='p00001']"><
tr><
td><
xsl:value-of select="InstID"/></
td></
tr></
xsl:for-each></
table></
body></
html></
xsl:template></
xsl:stylesheet>Change the ID as per your requirement
Hope this helps you
www.ashokraja.me
Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved.