RE: [xsl] XPath 2.0

Subject: RE: [xsl] XPath 2.0
From: Ed Blachman <EdB@xxxxxxxxxxx> (by way of Mulberry Technologies List Owner)
Date: Tue, 8 Jan 2002 16:35:34 -0500
From: Ed Blachman <EdB@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE: [xsl] XPath 2.0
Date: Tue, 8 Jan 2002 13:25:16 -0500

I just want to check my understanding (so far) of the WDs. My reading is that

(a) if nodes with ids a1 and a2 exist in the tree being queried,
     xf:id('a1') precedes xf:id('a2')
would raise an error because xf:id() returns a sequence, but the operands of
precedes must be single nodes or empty sequences -- explicitly *not*
non-empty sequences. The proper way to write this would therefore be
     xf:id('a1')[1] precedes xf:id('a2')[1]

(b) if nodes with ids a1 and a2 exist in the tree being queried,
     xf:id('a1')[1] precedes xf:id('a2')[1]
is equivalent to
     xf:exists( xf:id('a1') intersects xf:id('a2')/preceding::* )

And similarly
     xf:id('a1')[1] << xf:id('a2')[1]
is equivalent to
     xf:exists( xf:id('a1') intersects ( xf:id('a2')/preceding::* | xf:id('a2')/ancestor::* ) )

(I thought that something in the discussion of xf:boolean(), which would be
the wrong casting function to use here, suggested that I wouldn't need to
use xf:exists(), because a non-empty sequence would automatically be treated
as the boolean value true. But I couldn't find that when I went to look for
it, and decided that using xf:exists() would make the intent clearer in any
case.)

Does that look correct?

-- ed
----- end -----

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread