[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

Subject: Re: Check a node in my XML contains a particular value!
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 13 May 2002 14:37:52 +0100
xml contains
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.