[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Finding Nodes That Match Distinct Node Value

Subject: RE: Finding Nodes That Match Distinct Node Value
From: <Trish@xxxxxxxxxxxxxx>
Date: Thu, 8 May 2008 14:30:08 -0400
RE:  Finding Nodes That Match Distinct Node Value
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&#160;&#8226;&#160;<a href="#2006">2 0 0
6</a>&#160;&#8226;&#160;<a href="#2005">2 0 0 5</a>&#160;&#8226;&#160;<a
href="#2004">2 0 0 4</a><br />
               </xsl:when>
               <xsl:when test=". = '2006'">
                  <a href="#2007">2 0 0 7</a>&#160;&#8226;&#160;2 0 0
6&#160;&#8226;&#160;<a href="#2005">2 0 0 5</a>&#160;&#8226;&#160;<a
href="#2004">2 0 0 4</a><br />
               </xsl:when>
               <xsl:when test=". = '2005'">
                  <a href="#2007">2 0 0 7</a>&#160;&#8226;&#160;<a
href="#2006">2 0 0 6</a>&#160;&#8226;&#160;2 0 0 5&#160;&#8226;&#160;<a
href="#2004">2 0 0 4</a><br />
               </xsl:when>
               <xsl:when test=". = '2004'">
                  <a href="#2007">2 0 0 7</a>&#160;&#8226;&#160;<a
href="#2006">2 0 0 6</a>&#160;&#8226;&#160;<a href="#2005">2 0 0
5</a>&#160;&#8226;&#160;2 0 0 4<br />
               </xsl:when>
               <xsl:otherwise>
                  <a href="#2007">2 0 0 7</a>&#160;&#8226;&#160;<a
href="#2006">2 0 0 6</a>&#160;&#8226;&#160;<a href="#2005">2 0 0
5</a>&#160;&#8226;&#160;<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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.