Subject: RE: [xsl] Elminitate redundancy by using variables From: "Kenny Akridge" <kenny@xxxxxxxxxxxxxxxxx> Date: Wed, 24 Mar 2004 08:25:48 -0500 |
This is interesting Michael. Does .NET currently support XSLT 2.0? I keep hearing great things about SAXON, but I am currently working with C#. I've heard things about J# for .NET. I'm wondering if SAXON is going to be ported over to .NET in any shape or form. Thanks again. -----Original Message----- From: Michael Kay [mailto:mhk@xxxxxxxxx] Sent: Wednesday, March 24, 2004 4:38 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] Elminitate redundancy by using variables <tr> <xsl:attribute name="style"> <xsl:text>background-color: </xsl:text> <xsl:choose> <xsl:when test="number($count) mod 2 = 0"> <xsl:text>#FFFFFF;</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>#E7EEFF;</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:attribute> <td class="fieldInfo"> <xsl:value-of select="substring(LineItemName,1,45)"/> </td> </tr> Or in XSLT 2.0: <tr style="background-color: {if (number($count) mod 2 = 0) then '#FFFFFF;' else '#E7EEFF;'}/> <td class="fieldInfo"> <xsl:value-of select="substring(LineItemName,1,45)"/> </td> </tr> No variables needed in either case. Michael Kay # -----Original Message----- # From: Kenny Akridge [mailto:kenny@xxxxxxxxxxxxxxxxx] # Sent: 24 March 2004 02:59 # To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx # Subject: [xsl] Elminitate redundancy by using variables # # Imagine I have xsl similar to this: # # <xsl:choose> # <xsl:when test="number($count) mod 2 = 0"> # <tr style="background-color: #FFFFFF;"> # <td class="fieldInfo"> # <xsl:value-of # select="substring(LineItemName,1,45)"/> # </td> # </tr> # </xsl:when> # <xsl:otherwise> # <tr style="background-color: #E7EEFF;"> # <td class="fieldInfo"> # <xsl:value-of # select="substring(LineItemName,1,45)"/> # </td> # </tr> # </xsl:otherwise> # </xsl:choose> # # You can easily see that this would be a nightmare if I had # even just 5 <td> elements being repeated. Is there a way to # save the value from the beginning of the <td> to the end, # including the generate value of LineItemName? # # Thanks. # # #
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Elminitate redundancy by , Michael Kay | Thread | RE: RE: [xsl] Elminitate redundancy, cknell |
RE: [xsl] Validating xslt against a, Windsor, Michael | Date | RE: [xsl] Validating xslt against a, Michael Kay |
Month |