Subject: RE: [xsl] Finding Nodes That Match Distinct Node Value From: <Trish@xxxxxxxxxxxxxx> Date: Thu, 8 May 2008 14:30:08 -0400 |
Both solutions proposed work fine. Thank you for your help. I went with using a key after all, since my XML file could get fairly large over time. Here's an excerpt of the final code: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="no" encoding="UTF-8" doctype-public="-//W3C/DTD XHTML 1.0 Transitional//EN" /> <xsl:key name="keyFestival" match="Artist" use="@festival" /> <xsl:template match="/"> .... <table align="center" border="0" cellpadding="3" cellspacing="1"> <tr align="left" valign="top"> <td>artist</td> <td>date</td> <td>stage</td> </tr> <xsl:for-each select="//Artist/@festival[not(.=preceding::Artist/@festival)]"> <tr> <td colspan="3"> <a name="{.}"></a> <xsl:choose> <xsl:when test=". = '2007'"> 2 0 0 7 • <a href="#2006">2 0 0 6</a> • <a href="#2005">2 0 0 5</a> • <a href="#2004">2 0 0 4</a><br /> </xsl:when> <xsl:when test=". = '2006'"> <a href="#2007">2 0 0 7</a> • 2 0 0 6 • <a href="#2005">2 0 0 5</a> • <a href="#2004">2 0 0 4</a><br /> </xsl:when> <xsl:when test=". = '2005'"> <a href="#2007">2 0 0 7</a> • <a href="#2006">2 0 0 6</a> • 2 0 0 5 • <a href="#2004">2 0 0 4</a><br /> </xsl:when> <xsl:when test=". = '2004'"> <a href="#2007">2 0 0 7</a> • <a href="#2006">2 0 0 6</a> • <a href="#2005">2 0 0 5</a> • 2 0 0 4<br /> </xsl:when> <xsl:otherwise> <a href="#2007">2 0 0 7</a> • <a href="#2006">2 0 0 6</a> • <a href="#2005">2 0 0 5</a> • <a href="#2004">2 0 0 4</a><br /> </xsl:otherwise> </xsl:choose> </td> </tr> <xsl:for-each select="key('keyFestival', .)"> <tr> <td><a href="{Url}"><xsl:value-of select="@name" /></a></td> <td><xsl:value-of select="Date" /></td> <td><xsl:value-of select="Stage" /></td> </tr> </xsl:for-each> </xsl:for-each> </table> ... </xsl:template> </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Finding Nodes That Match , David Carlisle | Thread | [xsl] RE: Finding Nodes That Match , Tony Nassar |
RE: [xsl] Help with an xsl:if, Trish | Date | Re: [xsl] Up Conversion - Best Prac, David Carlisle |
Month |