[Home] [By Thread] [By Date] [Recent Entries]
Newman, John W wrote:
Processor details: Name: org/apache/xalan Comment: Main Xalan engine implementing TrAX/JAXP Specification-Title: Java API for XML Processing Specification-Vendor: Sun Microsystems Inc. Specification-Version: 1.2 Implementation-Title: org.apache.xalan Implementation-Version: 2.6.0 Here is an XSLT 1.0 stylesheet that use the exsl:node-set extension function. As far as I know Xalan supports that or at least has an extension function in its own namespace that has the same result: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" exclude-result-prefixes="exsl" version="1.0"> <xsl:output method="text"/> <xsl:param name="nl" select="' '"/> <xsl:template match="root"> <xsl:variable name="sorted-elements"> <root> <xsl:for-each select="red | blue"> <xsl:sort select="@order" data-type="number"/> <xsl:copy-of select="."/> </xsl:for-each> </root> </xsl:variable> <xsl:apply-templates select="exsl:node-set($sorted-elements)/root/*[1]"/> </xsl:template> <xsl:template match="blue | red">
<xsl:if test="not(preceding-sibling::*[1]/@key = @key)">
<xsl:value-of select="concat(@key, $nl)"/>
</xsl:if>
<xsl:value-of select="concat(@text, $nl)"/>
<xsl:apply-templates select="following-sibling::*[1]"/>
</xsl:template></xsl:stylesheet> -- Martin Honnen http://msmvps.com/blogs/martin_honnen/
|

Cart



