Re: [xsl] Problem with count() function using Xalan

Subject: Re: [xsl] Problem with count() function using Xalan
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 21 Nov 2007 17:36:45 GMT
without seeing your input can't really comment but avoid

     <xsl:variable name="taille_struct">
       <xsl:value-of select="count($struct/PARAMS/PARAM)"/>

which is relatively expensive and makes $taille_struct a result tree
fragment with a document node and a child text node with text the
decimal value of the number, instead do

     <xsl:variable name="taille_struct" select="count($struct/PARAMS/PARAM)"/>

which just defines  $taille_struct to be the number directly.

However it'll still be 1:-)

To debug, go

how many PARAM:
<xsl:copy-of select="$struct/PARAMS/PARAM"/>


and see how many elements you have. If you only have 1 element then your
problem is not with count() it is with your Xpath selecting the wrong
input. If you have 5 elements but count() is returning 1 then something
is very wrong, somewhere.


The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 

Current Thread