Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - XSL transformation not works for code reuse >Thread Next - Re: XSL transformation not works for code reuse Re: XSL transformation not works for code reuseTo: 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 < 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 | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
