Subject: Re: [xsl] Using SubString From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Fri, 24 Aug 2007 10:32:47 +0100 |
On 8/24/07, Yaswanth <yaswanth.mtrx@xxxxxxxxx> wrote: > Hi All, > > ------------------ > I have a XML as : > > <root> > <connection value ="//every123/event321" /> > <connection value ="//once123/every321" /> > <connection value ="//every123/every321/event123" /> > </root> > ----------------- > And my XSL is > > <xsl:template match="root"> > <xsl:for-each select="connection"> > <xsl:variable name="value" select="@value" /> > <xsl:if test="contains($value, 'every') and contains($value, 'event')"> > <xsl:text>1 every and 1 Event</xsl:text> > </xsl:if> > <xsl:if test="contains($value, 'every') and contains($value, 'once')"> > <xsl:text>1 every and 1 once</xsl:text> > </xsl:if> > </xsl:for-each> > </xsl:template> > ---------------- > What exactly I am trying to do is for every Connection I am analyzing the > value of @value. > > I.e. if I have One every and One event in the @value I am trying to do some > thing similarly with one every and one once! > > Now my problem is how can I identify the condition where @value has Two > Every's and One Event (Ex : root/connection[3]/@value)? > > How to form a condition? If you using 2.0 or 1.0 + extensions then tokenize on / If you stuck with 1.0 on its own, then you'll need to recursively process the string using a named template. Or if possible alter your input XML to be elements rather than... they look like XPaths? <connection> <every123> <event123> .... -- http://andrewjwelch.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Using SubString, Yaswanth | Thread | [xsl] recto/verso vs odd/even, Carlos Villegas |
[xsl] Using SubString, Yaswanth | Date | [xsl] recto/verso vs odd/even, Carlos Villegas |
Month |