Re: expression value not a node set on content match

Subject: Re: expression value not a node set on content match
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 3 May 2000 21:00:44 -0600 (MDT)
I wrote:
> select="record[ @tag='773'
>                 and contains(.,'21 ')
>                 and *[ @code='x'
>                        and contains(.,'0141-6400') ]
>               ]"

I should probably have made that first contains() function look more like
contains(text(),'21 '). With contains(.,'21 '), you're testing the
string-value of the entire 'record' element, which is going to be the
concatenation of all its descendant text nodes, including the ones that
are children of the sub-elements. You really only want to test the text
node child(ren) of the 'record' element. The same might apply for the
sub-element if there is a risk of more elements below.

In my code I go to the trouble of specifying text() instead of . more
often than not, to avoid any potential ambiguities like this.

   - Mike
___________________________________________________________
Mike J. Brown, software engineer, Webb Interactive Services
XML/XSL stuff: http://www.skew.org/    http://www.webb.net/


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


Current Thread