Subject: Re: [xsl] XSLT filter syntax advice? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 26 Nov 2009 13:01:46 +0530 |
Hey folks -
I'm trying to use XSLT to transform the following XML into HTML...
<Catalog> <Category> <Name>Category A</Name> <Item> <Id>Item 1a</Id> <Rank>1</Rank> <Title><![CDATA[The Title of Item 1a]]></Title> <Description><![CDATA[a great description of item 1a]]></Description> </Item> <Item> <Id>Item 2a</Id> <Rank>2</Rank> <Title><![CDATA[The Title of Item 2a]]></Title> <Description><![CDATA[a great description of item 2a]]></Description> </Item> </Category> <Category> <Name>Category B</Name> <Item> <Id>Item 1b</Id> <Rank>5</Rank> <Title><![CDATA[The Title of Item 1b]]></Title> <Description><![CDATA[a great description of item 1b]]></Description> </Item> <Item> <Id>Item 2b</Id> <Rank>10</Rank> <Title><![CDATA[The Title of Item 2b]]></Title> <Description><![CDATA[a great description of item 2b]]></Description> </Item> </Category> </Catalog>
I'm getting hung up on the XSLT syntax that will display all the "Items" for a particular Category. I can list the categories - or the Items, but listing the items in a particular category is not working so well.
I assume I need to pass the category as a parameter, but still not getting it quite right.
<xsl:for-each select="/Catalog/Category"> ...stuff for category... <xsl:for-each select="Item"> ...stuff for the item within the category... </xsl:for-each> </xsl:for-each>
-- Vote for your XML training: http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSLT filter syntax advice?, Doug Meade | Thread | RE: [xsl] XSLT filter syntax advice, Michael Kay |
[xsl] Value of the variable, Joga Singh Rawat | Date | Re: [xsl] Value of the variable, G. Ken Holman |
Month |