Heppa,
> If there is several sorting orders, they are all applied and not
> only the last one. For example if there is xml file that includes
> severals sets like:
>
> <Subject id="0000000001" id2="001" id3="001">Juu juu</Subject>
> <Subject id="0000000001" id2="002" id3="002">RE:Juu juu</Subject>
> <Subject id="0000000001" id2="002" id3="001">RE:Juu juu</Subject>
>
> and sets are sorted:
> <xsl:sort select="Subject/@id" order="ascending" />
> <xsl:sort select="Subject/@id2" order="ascending" />
> <xsl:sort select="Subject/@id3" order="ascending" />
>
> So the result would be:
> <Subject id="0000000001" id2="001" id3="001">Juu juu</Subject>
> <Subject id="0000000001" id2="002" id3="001">RE:Juu juu</Subject>
> <Subject id="0000000001" id2="002" id3="002">RE:Juu juu</Subject>
>
> Right?
Right, but make sure when you're using the sort instruction that your context node is the corrent one for the sort select expressions. If you have
<xsl:for-each select="Subject">
<xsl:sort select="Subject/@id" order="ascending" />
<xsl:sort select="Subject/@id2" order="ascending" />
<xsl:sort select="Subject/@id3" order="ascending" />
<xsl:copy-of select="." />
</xsl:for-each>
that will not work, because the Subject doesn't have a Subject child. Instead use
<xsl:template match="f">
<xsl:for-each select="Subject">
<xsl:sort select="@id" order="ascending" />
<xsl:sort select="@id2" order="ascending" />
<xsl:sort select="@id3" order="ascending" />
<xsl:copy-of select="." />
</xsl:for-each>
</xsl:template>
Cheers,
Santtu
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- RE: xsl sorting
- Jarno . Elovirta - Wed, 17 Apr 2002 02:19:24 -0400 (EDT) <=
- Greg Faron - Wed, 17 Apr 2002 12:01:04 -0400 (EDT)
|
|