[xml] XPath null nodes and false()



Hi,

first off - the spec isn't very clear:
"A node test that is a QName is true if and only if the type of the node (see [5 Data Model]) is the principal node type and has an expanded-name equal to the expanded-name specified by the QName. For example, child::para selects the para element children of the context node; if the context node has no para children, it will select an empty set of nodes."

For me, that translates to:
A node test is true .... otherwise it is an empty set of nodes. Since true in combination with otherwise, usually gives 'false', I assume that an empty set of nodes equals false.

However - the following illustrates it doesn't:
<xsl:when test="preceding-sibling::kid = false()">
<xsl:when test="count(preceding-sibling::kid) = 0">

When I use these in seperate files, but the rest is exactly the same - they produce opposite results.

Isolated testcase files attached.

Maybe it's correct - but to me the spec leaves room to correct this unexpected behavior.

Since docbook doesn't have a container for everything, I find myself using these constructs quite often.

Software used:
$ xsltproc --version
Using libxml 20419, libxslt 10015 and libexslt 706
xsltproc was compiled against libxml 20419, libxslt 10015 and libexslt 706
libxslt 10015 was compiled against libxml 20419
libexslt 706 was compiled against libxml 20419




Best regards,

Melvyn Sopacua
WebMaster IDG.nl
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
If it applies, where it applies - this email is a personal
contribution and does not reflect the views of my employer
IDG.nl.
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\

Attachment: testcase.tgz
Description: application/compressed


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.343 / Virus Database: 190 - Release Date: 22-3-2002


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]