Subject: RE: [xsl] Problem writing a XSLT stylesheet From: Mukul <mukulw3@xxxxxxxxx> Date: Tue, 18 Feb 2003 09:06:37 -0800 (PST) |
Hi Jarno , Thanks a lot for your reply.. Your solution works for my problem.. I am trying some more things.. I'll ask few more questions related to this.. Regards, Mukul --- Jarno.Elovirta@xxxxxxxxx wrote: > Hi, > > [...] > > > There are certain tags missing in <TAG>. The > missing > > tags <A> and <B> are repetitive information. > Therefore > > 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. > > > > The <A> tag can have 3 possible values > > value1, value2, value3 > > > > Based on this value, the label for <E> that needs > to > > be output will change -- > > if <A> is value1, output E's label as Label1 > > if <A> is value2, output E's label as Label2 > > if <A> is value3, output E's label as Label3 > > > > > > I want the output to appear as > > > > Label1 <value-of E> > > Label3 <value-of E> > > Label2 <value-of E> > > ..etc > > (the Labels will be different depending on the > value > > of <A>) > > [...] > > If I understood you correctly > > <xsl:template match="/"> > <xsl:for-each select="rootelem/TAG/E"> > <xsl:variable name="A" select="preceding::A[1]" > /> > <xsl:choose> > <xsl:when test="$A = > 'value1'">Label1</xsl:when> > <xsl:when test="$A = > '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:template> > > displays how it can be achieved. It may be worth > testing if keys could speed things up, but if your > document is smallish, preceding axis may be faster. > > Cheers, > > Jarno - Assemblage 23: Document (Ultimate-Gloom-Mix > By Echo Image) > > XSL-List info and archive: > http://www.mulberrytech.com/xsl/xsl-list > __________________________________________________ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Problem writing a XSLT st, Jarno . Elovirta | Thread | RE: [xsl] Problem writing a XSLT st, Mukul |
[xsl] incremental re-transformation, Felix Breuer | Date | [xsl] The Perils of Sudden Type-Saf, Gunther Schadow |
Month |