Subject: RE: Problem writing a XSLT stylesheet
From: Mukul <mukulw3@xxxxxxxxx>
Date: Wed, 19 Feb 2003 02:09:33 -0800 (PST)
|
Hi Jarno ,
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..?
Can you kindly reply..?
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
|