This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: expression value not a node set on content match


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]