[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Testing for a specific word in a string

Subject: Re: Testing for a specific word in a string
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Wed, 05 Mar 2008 13:26:25 +0100
Re:  Testing for a specific word in a string
Aaron Johnson wrote:

I have a set of tests which assign various parameters. Sometimes the
string values are similar and require the same variable to be used.

<xsl:when test="($tabName = 'Pilot')">pilotTab</xsl:when>
<xsl:when test="($tabName = 'Pilot 2')">pilotTab</xsl:when>
<xsl:when test="($tabName = 'Pilot 3')">pilotTab</xsl:when>

Instead of replicating the test over and over, I would like to extend
the test to check for the word 'pilot' and so do away with repetition.
I have tried various ways including 'contains' and 'begins-with' but I
can't get it to work.

<xsl:when test="starts-with($tabName, 'Pilot')">pilotTab</xsl:when>
should do. Or
<xsl:when test="contains($tabName, 'Pilot')">pilotTab</xsl:when>
If that does not work for you then you need to provide details like error message(s) you get, the input you have.


--

	Martin Honnen
	http://JavaScript.FAQTs.com/

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.