Subject: RE: [xsl] Problem writing a XSLT stylesheet From: Jarno.Elovirta@xxxxxxxxx Date: Thu, 20 Feb 2003 08:29:04 +0200 |
Hi, > If you recall my problem. It remains same. I wrote > in my problem .. > > "the first <TAG> tag will have data and will not be > present in tags after that unless there is a change in > these tag's value" > > Can I test when the value of <A> tag changes? I want > to display a line break as '---------' when value of > <A> will change..? So your problem is basically a grouping one. See Jeni's grouping pages, <http://jenitennison.com/xslt/grouping> IIRC. <xsl:key name="x" match="TAG[not(A)]" use="generate-id(preceding::A[1])" /> <xsl:template match="/"> <!--get all TAGs with A--> <xsl:for-each select="rootelem/TAG[A]"> <xsl:variable name="x" select="A" /> <!--process current TAG and all following without A before next TAG with A--> <xsl:for-each select=". | key('x', generate-id($x))"> <xsl:choose> <xsl:when test="$x = 'value1'">Label1</xsl:when> <xsl:when test="$x = 'value2'">Label2</xsl:when> <xsl:otherwise>Label3</xsl:otherwise> </xsl:choose> <xsl:text> </xsl:text><xsl:value-of select="."/><xsl:text>
</xsl:text> </xsl:for-each> <xsl:text>---------
</xsl:text> </xsl:for-each> </xsl:template> You still didn't show us your desired output, so again I'm assuming this is what you want. It uses node identity in case there are multiple TAG elements with the same value for A child. It's the fourth Monday of this week and my knees are busted, so it shouldn't be a surprise that there a probably faster ways to solve this. Cheers, Jarno - Feindflug: Glaubenskrieg XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Problem writing a XSLT st, Mukul | Thread | RE: [xsl] Problem writing a XSLT st, Mukul |
RE: [xsl] Saxon is the best!!!, Rakesh | Date | RE: [xsl] Saxon is the best!!!, Jarno . Elovirta |
Month |