Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Advanced sort

From: Delf <abuse@-------.-->
To: NULL
Date: 3/17/2009 7:42:00 PM
Martin Honnen a pensé très fort :

> That data above is not what you posted initially.

Sure. It was just an example but it is the same way.

> Your stylesheet has the right approach with the key but I think it can be 
> much shorter, at least for the data you posted originally:
>
> <xsl:stylesheet
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>    version="1.0">
>
>    <xsl:output method="xml" indent="yes"/>
>
>    <xsl:key name="by-tag"
>             match="tag"
>             use="."/>
>
>    <xsl:template match="/items">
>      <tags>
>        <xsl:apply-templates select="item/tags/tag[generate-id() = 
> generate-id(key('by-tag', .)[1])]">
>          <xsl:sort select="count(key('by-tag', .))" data-type="number" 
> order="descending"/>
>        </xsl:apply-templates>
>      </tags>
>    </xsl:template>
>
>    <xsl:template match="tag">
>      <tag id="{.}">
>        <xsl:value-of select="count(key('by-tag', .))"/>
>      </tag>
>    </xsl:template>
>
> </xsl:stylesheet>

I'll try this sample, thanks.
Now, I've decided to provide data using Xml Web Services but the page 
render will use Javascript + Xsl transformation.

--
Delf




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent