Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML & XSL

Status
Not open for further replies.

Kazzy

Programmer
Jul 21, 2003
20
US
Help....This is my xml file. I am trying to display/desing the layout for a asp page. I need to be able to select each category and display in specific area on the asp page.(for example.. I need to be able to select category-name = 'Articles' and display all the category-items under that category and do the same for the other categories.) I am playing with the xslt however, I am still having problems. I am not sure if I can do that...very new to xml/xsl ...Thanks

<?xml version="1.0" encoding="iso-8859-1"?>
<CARD>
<DATAAREA>
<folder>
<folder-name>Name of Folder</folder-name>
<category>
<category-name>Articles</category-name>
<category-items>
<item-name>more blah blah..</item-name>
<item-description>blah blah..</item-description>
<item-id>1100</item-id>
</category-items>
<category-items>
<item-name>More More blahh</item-name>
<item-description>xxdhfkas</item-description>
<item-id>1001</item-id>
</category-items>
</category>
<category>
<category-name>FAQ</category-name>
<category-items>
<item-name>blahh blahh.</item-name>
<item-description>more.</item-description>
<item-id>1101</item-id>
</category-items>
<category-items>
<item-name>blahh blahh...</item-name>
<item-description>more..</item-description>
<item-id>1022</item-id>
</category-items>
</category>
.
.
. more
</folder>
</DATAAREA>
</CARD>
 
Here it is...Again I not sure what i am doing...What I am trying to do is display all the category-items (item-name, item-id) if category-name is equal to 'Articles' in this sample...thanks

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="<xsl:template match="category">
<html>
<body>
<table>
<xsl:for-each select="category">
<xsl:if test="category-name = 'Articles'">
<tr>
<td><xsl:apply-templates value-of select="child::item_name/following-sibling::*"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top