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]
Other format: [Raw text]

RE: selecting with text nodes


Hi Ian,

>Hi,
>
>I am having a problems trying to select elements based on the text contents
>of child nodes. For example how would I convert [...]

What kind of problems are you having? In theory it should be as simple as
selecting elements on their attributes, which you say you can do fine.

Instead of testing for an attribute value in your predicate eg 
	element[@attribute='myValue']

you test for the value of the child element:
	element[childElement = 'myValue']

This is because the childElement element is converted into a string for the
purpose of the comparison. I suppose you could also do child/text() =
'myValue' or even normalize-space(child/text()), but start simple :)
 
nb once you start doing comparisons on a node's 'value' like this, be aware
that this value will depend on what it's being compared with. There's a
detailed section on this in Mike Kay's book.

regards,
Tom Weissmann

 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]