Re: [xsl] JDK 1.4 <> 5.0 transformation compatibility

Subject: Re: [xsl] JDK 1.4 <> 5.0 transformation compatibility
From: Kai Hackemesser <kaha@xxxxxx>
Date: Mon, 18 Jun 2007 15:26:17 +0200

I'm currently tracing down that error in xsltc transformation from last week. In the source below I marked two lines with ==> - the first one shows me how many nodes were selected before calling the template handleN. The result was > 0 in my tests and that was ok: handleN got a filtered list of N in $ns. The second comment didn't appear in the result. I placed a comment above the for-each, too, and the variable $ns still held a number of nodes. but the for-each sort returned without doing the requested work. If I remove the xsl:sort tags in in the for-each it works. So sorting is working wrong. Or do you see another problem? Keep in mind, this source did work with internal xalan in 1.4.2 and id also works with external xalan 2.7 in 1.5/1.6.

Kind regards,

I dived in using comments in the output to see, where I have what values.

   <xsl:key name="ADNCategory" match="AD/N"
       use="concat(generate-id(..) , string(Category))"/>

<xsl:template name="displayN">
<xsl:variable name="currentAD" select="."/>
<!-- Alle Categories durchgehen -->
<xsl:variable name="categories"
select="N[generate-id(.)= generate-id(key('ADNCategory', concat(generate-id($currentAD) , string(Category)))[1])]/Category"/>
<xsl:for-each select="$categories">
<xsl:variable name="category" select="."/>
<xsl:variable name="nPerCategory"
select="$currentAD/N[Category = $category]"/>
==> <xsl:comment>N selected: <xsl:value-of select="count($nPerCategory)"/></xsl:comment>
<xsl:call-template name="handleN">
<xsl:with-param name="ns" select="$nPerCategory"/>

<xsl:template name="handleN">
<xsl:param name="ns"/>
<td colspan="2">
<xsl:for-each select="$ns">
<xsl:sort select="Year" data-type="number" order="descending"/>
<xsl:sort select="Number" data-type="number" order="descending"/>
==> <xsl:comment>current N: <xsl:value-of select="."/></xsl:comment>
<xsl:call-template name="nHeader"/>
<xsl:text> </xsl:text>

Current Thread