This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: A problem with loop and Concat....
- From: Oleg Tkachenko <olegt at multiconn dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 29 Apr 2002 15:29:48 +0200
- Subject: Re: [xsl] A problem with loop and Concat....
- Organization: Multiconn International
- References: <OFAD1D04AF.84D4D2E7-ON65256BAA.003C3E18@etindia.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Mukul.Mudgal@etindia.com wrote:
> I'm trying to write a xsl file to transform this
>
> - <WhereDetails Operator="OR">
> <Description Name="accountid" Condition="=" Value="
> 1000" Operator="And" />
> <Description Name="SortCode" Condition="=" Value="
> 1001" Operator="Or" />
> <Description Name="accountType" Condition="=" Value
> ="Saving" Operator="" />
>
> </WhereDetails>
>
> in to this
> - <WHERE>
> <Clause Value="accountid = 1000 And sortCode = 1001 Or
> accountType = Saving " />
> </WHERE>
>
>
> Here , we need to take care of one point......
> 1. If there is no operator is defined in <Description> node then we need to
> take the Operator which defined in <WhereDetails> node.
That's very simple one, where was your trouble?
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="WhereDetails">
<WHERE>
<xsl:attribute name="Value">
<xsl:apply-templates/>
</xsl:attribute>
</WHERE>
</xsl:template>
<xsl:template match="Description">
<xsl:value-of select="@Name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@Condition"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@Value"/>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="@Operator">
<xsl:value-of select="@Operator"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="../@Operator"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>
--
Oleg Tkachenko
Multiconn International, Israel
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list