[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Check a node in my XML contains a particular value
Hi George, > At present I am using <xsl:when > test="starts-with(wcc/wcc-category-oid, 'CSE')"> and my research > comes back with the usage of <xsl:when > test="contains(wcc/wcc-category-oid, 'CSE')">, but this only checks > that both string values are identical (I think, correct me if I am > wrong). The starts-with() function tests whether the value of the node that you select starts with a particular string; the contains() function tests whether the value of the node you select contains a particular string. If you want to test whether the string is identical to the node, then you'd use =. For example, starts-with('CSE is what this is', 'CSE') would be true, as would: contains('CSE is what this is', 'CSE') contains('This is a CSE', 'CSE') Is that not what you're getting? Perhaps you're testing the wrong path -- what's your context node at the point where you're doing the test? What node are you processing at that point? You need to make sure that the path is relative to that node, so for example if you're already on the wcc element, you need to do just: contains(wcc-category-oid, 'CSE') Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|