xsl:number when no matching nodes

A

Andy Fish

In my XSLT stylesheet, if I call

<xsl:number level="any" count="sdfsjdfjsdfksndfn"/>

where there are no preceeding nodes called "sdfsjdfjsdfksndfn" I would
expect it to return 0. However, on the XSLT processor I'm using (.net
framework 1.1) it seems to return an empty string (or possibly an empty node
set)

I had a look here: http://www.w3.org/TR/xslt and I can't find any
specification of what should happen if xsl:number can't find any nodes to
number. Is it safe to rely on the "empty string" behaviour?

Andy
 
M

Martin Honnen

Andy said:
In my XSLT stylesheet, if I call

<xsl:number level="any" count="sdfsjdfjsdfksndfn"/>

where there are no preceeding nodes called "sdfsjdfjsdfksndfn" I would
expect it to return 0. However, on the XSLT processor I'm using (.net
framework 1.1) it seems to return an empty string (or possibly an empty node
set)

I had a look here: http://www.w3.org/TR/xslt and I can't find any
specification of what should happen if xsl:number can't find any nodes to
number. Is it safe to rely on the "empty string" behaviour?

I have tried with MSXML, with Saxon, and with Xalan, the latter produces
a 0, the other ones an empty string.
So that seems indeed to be an area where processor behaviour differs.
 
A

Andy Fish

Martin Honnen said:
I have tried with MSXML, with Saxon, and with Xalan, the latter produces a
0, the other ones an empty string.
So that seems indeed to be an area where processor behaviour differs.

Thanks Martin,

I would have thought 0 is more logical. Still, putting a test for '' and
turning it into a 0 is compatible with them all so it's no big deal.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top