xsl:number when no matching nodes

Discussion in 'XML' started by Andy Fish, Mar 16, 2005.

  1. Andy Fish

    Andy Fish Guest

    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
     
    Andy Fish, Mar 16, 2005
    #1
    1. Advertising

  2. Andy Fish wrote:

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

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Mar 16, 2005
    #2
    1. Advertising

  3. Andy Fish

    Andy Fish Guest

    "Martin Honnen" <> wrote in message
    news:42386a88$0$1088$-online.net...
    >
    >
    > Andy Fish wrote:
    >
    >> 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.
    >


    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.

    > --
    >
    > Martin Honnen
    > http://JavaScript.FAQTs.com/
     
    Andy Fish, Mar 16, 2005
    #3

  4. > So that seems indeed to be an area where processor behaviour differs.


    Note that there are some clarifications/errata in the area of xsl:number
    on no matching nodes

    http://www.w3.org/1999/11/REC-xslt-19991116-errata/#E23

    so some processors may have been fixed before this clarification was
    made...

    David
     
    David Carlisle, Mar 16, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. asd
    Replies:
    3
    Views:
    440
    Arnaud Berger
    May 23, 2005
  2. gavnosis
    Replies:
    0
    Views:
    524
    gavnosis
    Aug 2, 2003
  3. Timo Nentwig

    selecting nodes between other nodes

    Timo Nentwig, Jun 16, 2004, in forum: XML
    Replies:
    1
    Views:
    409
    Patrick TJ McPhee
    Jun 17, 2004
  4. Johnny Ooi

    Looking A Nodes From Within Nodes

    Johnny Ooi, Nov 13, 2004, in forum: XML
    Replies:
    10
    Views:
    657
    Johnny Ooi
    Nov 14, 2004
  5. Replies:
    1
    Views:
    3,613
    A. Bolmarcich
    May 27, 2005
Loading...

Share This Page