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

Re: Assistance with the Muenchian method

Subject: Re: Assistance with the Muenchian method
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 10 Dec 2001 19:28:49 +0000
wid wid
Hi Garrel,

> <xsl:template match="userData">
>   <xsl:for-each
> select="publish/website[generate-id()=generate-id(key('groups-by-wid',
> @wid)[1])]">
>     <xsl:sort select="@path"/>
>     <xsl:variable name="wid" select="@wid"/>
>     <xsl:for-each select="key('groups-by-wid', $wid)">
>       <xsl:variable name="path" select="@path"/>
>       <xsl:variable name="wid" select="@wid"/>
>       <option value="{$wid}"><xsl:value-of select="$path"/></option>
>     </xsl:for-each>
>   </xsl:for-each>
> </xsl:template>

In the above, you select the websites with unique wids absolutely
correctly. Then you sort them, and then you collect together all the
websites with the same wid and create an option for each of them. The
above code is equivalent to selecting all the websites at once and
sorting them by wid:

  <xsl:for-each select="publish/website">
    <xsl:sort select="@path" />
    <option value="{@wid}"><xsl:value-of select="@path" /></option>
  </xsl:for-each>

Instead, you only want to create the option for the unique websites,
so scrap the inner xsl:for-each and just do:

  <xsl:for-each select="publish/website
                          [generate-id()=
                           generate-id(key('groups-by-wid', @wid)[1])]">
    <xsl:sort select="@path"/>
    <option value="{@wid}"><xsl:value-of select="@path"/></option>
  </xsl:for-each>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.