Re: [xsl] Xalan giving TransformerException for a defined variable

Subject: Re: [xsl] Xalan giving TransformerException for a defined variable
From: Anton Triest <anton@xxxxxxxx>
Date: Fri, 01 Oct 2004 13:41:40 +0200
David Carlisle wrote:

The variable use looks correct although if you always call it with
<xsl:with-param name="shippedOrder" select="."/>
in your actual code then you could drop th eparam as the current node
is still the current node in the called template, you don;t need to pass
it directly.

and even if you want to call it with some other node in the select, you could drop the param
by using apply-templates with a mode instead of call-template:


<xsl:template match="ORDER">
   <xsl:element name="Shipment">
       <xsl:apply-templates select="." mode="generate-containers"/>
   </xsl:element>
</xsl:template>

<xsl:template match="*" mode="generate-containers">
<xsl:variable name="shippedOrder" select="."/>
<xsl:variable name="listoftrackingnumbers">
<xsl:for-each select=".//PACKAGE[generate-id(.) = generate-id(key('container-group', TRACKING_NUMBER)[1])]">
<xsl:sort select="count($shippedOrder/ORDER_DETAIL[.//PACKAGE/TRACKING_NUMBER = current()/TRACKING_NUMBER])"
order="ascending" data-type="number"/>
<xsl:value-of select="concat(TRACKING_NUMBER, '~')"/>
</xsl:for-each>
</xsl:variable>
</xsl:template>


Anton

Current Thread