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

Re: InString filter in XSL

Subject: Re: InString filter in XSL
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Thu, 24 Jun 1999 09:18:42 +0100
xsl instring
Christian,

Here's one way of doing it that works with James Clark's XT, and the
April 99 WD:

elAtt.xml contains:
--
<elAtt>
	<el att="aa, bb, cc">I want to select this</el>
	<el att="bb, cc">Or I want to select this</el>
	<el att="aa, cc">Or maybe I want to select this</el>
</elAtt>
--
elAtt.xsl contains:
--
<xsl:stylesheet indent-result="yes" default-space="strip" 
	xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
	
<xsl:template match="/">
	<result>
		<aa>
			<xsl:apply-templates select="//el[contains(@att, 'aa')]" />
		</aa>
		<bb>
			<xsl:apply-templates select="//el[contains(@att, 'bb')]" />
		</bb>
	</result>
</xsl:template>

<xsl:template match="el">
	att:'<xsl:value-of select="@att" />'
	value:'<xsl:value-of select="." />'
</xsl:template>

</xsl:stylesheet>
--
In windows I get this:
--
E:\xmlSchema>xt elAtt.xml elAtt.xsl
<result>
<aa>
        att:'aa, bb, cc'
        value:'I want to select this'

        att:'aa, cc'
        value:'Or maybe I want to select this'
</aa>
<bb>
        att:'aa, bb, cc'
        value:'I want to select this'

        att:'bb, cc'
        value:'Or I want to select this'
</bb>
</result>
--

All the best,

Francis.

Christian Wittern wrote:
> 
> Hi,
> 
> I am struggling with the following problem:
> 
> <el att="aa, bb, cc">I want to select this</el>
> <el att="bb, cc">Or I want to select this</el>
> <el att="aa, cc">Or maybe I want to select this</el>
> 
> I want to select nodes based on the value of att: Either those containing
> 'aa', or 'bb', or 'cc', regardless of the other surrounding values, i.e. if
> I check for 'aa', I'd like to get the first and last, in the case of 'bb'
> the first and second, etc.
> 
> Is there an easy way to do this in XSL?
> I am preparing this for IE5, but ideally would like this to stay compatible
> with the latest draft.
> 
> All the best,
> 
> Christian
> 
-- 
Francis Norton.

Air Rage - a "flight *and* fight" reaction?


 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.