Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL transformation not works for code reuse

From: "Magnus Henriksson" <magnus.henriksson@--------------.--->
To: NULL
Date: 12/2/2005 8:37:00 AM
"Rushi" <IMS.Rushikesh@g...> wrote in message
news:1133428891.024801.12260@g......
> <xsl:template name="format-book">
>    <xsl:param name="Rate" />
>    <xsl:param name="Book" />
>
> <xsl:choose>
>   <xsl:when test="$Rate &lt; 4">
>    <tr bgcolor="red">
>       <td><xsl:value-of select="$Book/Name" /></td>
>       <td><xsl:value-of select="$Rate" /></td>
>       </tr>
>   </xsl:when>
>   <xsl:otherwise>
>    <tr bgcolor="lightblue">
>       <td><xsl:value-of select="$Book/Name" /></td>
>       <td><xsl:value-of select="$Rate" /></td>
>       </tr>
>   </xsl:otherwise>
> </xsl:choose>
>
> </xsl:template>

> This sample is working fine, but think if user want change in
> presentation style then we need to update both code, although they are
> doing same stuff.....and also think if coder want to change structure
> of XML file then also we need to change both parts (ie. When tag and
> Otherwise tag).

> But is there any alternative??????

Divide and conquer! Create a new named template that outputs the <tr>
element and call that template from <when> and <otherwise>.

// Magnus




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent