This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: selecting with text nodes
- From: TSchutzerWeissmann at uk dot imshealth dot com
- To: xsl-list at lists dot mulberrytech dot com
- Date: Thu, 2 May 2002 15:15:28 +0100
- Subject: RE: [xsl] selecting with text nodes
- Reply-to: xsl-list at lists dot mulberrytech dot com
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