xsl-list
[Top] [All Lists]

RE: [xsl] Need help OR'ing in XPATH.

2006-03-22 05:50:26
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



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--