$match = true() for empty $match??

Discussion in 'XML' started by Victor, May 14, 2004.

  1. Victor

    Victor Guest

    While debugging my stylesheet using XMLSpy, I got a really weird result:
    <xsl:if test="$match = true()"> matches even if $match is an empty node
    fragment. How can this be?

    --
    Victor
     
    Victor, May 14, 2004
    #1
    1. Advertising

  2. In article <c82liu$rqk$>,
    Victor <> wrote:

    >While debugging my stylesheet using XMLSpy, I got a really weird result:
    ><xsl:if test="$match = true()"> matches even if $match is an empty node
    >fragment. How can this be?


    What do you mean by "empty node fragment"? Do you mean "empty node set",
    "empty result tree fragment", or what?

    If the value of $match is a node set, then "$match = true()" is true
    if and only if the node set is non-empty.

    If the value of $match is a result tree fragment, then it is
    "equivalent to a node-set containing just a single root node" (section
    11.2) so it is never empty and "$match = true()" is always true.

    I suspect this is different in XSLT version 2, which might explain why
    different versions of Saxon and Xalan give me different results when I
    test it.

    -- Richard
     
    Richard Tobin, May 14, 2004
    #2
    1. Advertising

  3. Victor

    Victor Guest

    Richard Tobin wrote:

    > In article <c82liu$rqk$>,
    > Victor <> wrote:
    >
    >
    >>While debugging my stylesheet using XMLSpy, I got a really weird result:
    >><xsl:if test="$match = true()"> matches even if $match is an empty node
    >>fragment. How can this be?

    >
    >
    > What do you mean by "empty node fragment"? Do you mean "empty node set",
    > "empty result tree fragment", or what?
    >
    > If the value of $match is a node set, then "$match = true()" is true
    > if and only if the node set is non-empty.
    >
    > If the value of $match is a result tree fragment, then it is
    > "equivalent to a node-set containing just a single root node" (section
    > 11.2) so it is never empty and "$match = true()" is always true.


    A-hah! Thank you, this seems to solve the mystery (especially since the
    XSL spec says empty node sets equal false().

    --
    Victor
     
    Victor, May 17, 2004
    #3
    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. Siemel Naran

    Does true ^ true return false?

    Siemel Naran, Jun 17, 2004, in forum: C++
    Replies:
    19
    Views:
    666
    Chris Theis
    Jun 18, 2004
  2. Chip
    Replies:
    6
    Views:
    2,635
    E. Robert Tisdale
    Jan 8, 2005
  3. Andy Leszczynski
    Replies:
    4
    Views:
    332
    Erik Max Francis
    Oct 13, 2005
  4. Pierre Quentel

    "0 in [True,False]" returns True

    Pierre Quentel, Dec 12, 2005, in forum: Python
    Replies:
    59
    Views:
    1,034
    Grant Edwards
    Dec 16, 2005
  5. bdb112
    Replies:
    45
    Views:
    1,346
    jazbees
    Apr 29, 2009
Loading...

Share This Page