xsl-list
[Top] [All Lists]

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

2007-11-21 10:37:55


without seeing your input can't really comment but avoid

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

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

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

===
</xsl:messgage>


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.

David

________________________________________________________________________
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. 
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>