|
Subject: Re: [xsl] Assistance with the Muenchian method From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Mon, 10 Dec 2001 19:28:49 +0000 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Assistance with the Muenchian, Renick, Garrel | Thread | [xsl] Assistance with the Muenchian, Renick, Garrel |
| [xsl] Assistance with the Muenchian, Renick, Garrel | Date | RE: [xsl] passing in path names of , Charu Anchlia |
| Month |