Subject: RE: Need help OR'ing in XPATH.
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 22 Mar 2006 12:49:57 -0000
|
> not that it will happen to you but its a best practice to
> refer a text value
> of a node by text().
>
> <xsl:a-t select="book[owner/text()='aaa' or
> chapter/owner/text()='aaa']"/>
>
No, this is absolutely *not* recommended. If you use /text(), your code will
be sensitive to the presence of comments within the text, and it's very
unusual that you should want comments to make any difference.
owner='aaa' compares the string value of the owner element against the
string 'aaa'. If the owner element is
<owner>aa<!--three stars-->a</owner>
then owner='aaa' will succeed, but owner/text() will fail.
Michael Kay
http://www.saxonica.com
|