[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
InString filter in XSL, Christian Wittern | Thread | Re: InString filter in XSL, Eugeny Kuzakov |
A little help, Chuck Robey | Date | Re: InString filter in XSL, Eugeny Kuzakov |
Month |