So you do :)
--
Joe
From: "Bjorndahl, Brad" <brad(_dot_)bjorndahl(_at_)thermofisher(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: "xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com"
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: RE: [xsl] Question about HTML tags
Date: Wed, 3 Oct 2007 17:06:35 -0400
You need a $ to indicate that it's a variable, as in:
<tr class="{$rowStyle}">
Brad
-----Original Message-----
From: Joe Fawcett [mailto:joefawcett(_at_)hotmail(_dot_)com]
Sent: October 3, 2007 5:00 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Question about HTML tags
I normally set up a variable, something like:
<xsl:variable name="rowStyle">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">lightRow</xsl:when>
<xsl:otherwise>darkRow</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr class="{rowStyle}">
<!-- other stuff -->
</tr>
It's a lot neater in XSLT 2.0 where you can use functions.
Joe
http://joe.fawcett.name/
>From: "Scott Trenda" <Scott(_dot_)Trenda(_at_)oati(_dot_)net>
>Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
>To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
>Subject: RE: [xsl] Question about HTML tags
>Date: Wed, 3 Oct 2007 15:51:21 -0500
>
><tr>
> <xsl:if test="sometest">
> <xsl:attribute name="style">background: gray;</xsl:attribute>
> </xsl:if>
> ... the rest of your content ...
></tr>
>
>~ Scott
>
>
>-----Original Message-----
>From: Chaudhary, Harsh [mailto:HCHAUDHA(_at_)amfam(_dot_)com]
>Sent: Wednesday, October 03, 2007 3:48 PM
>To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
>Subject: [xsl] Question about HTML tags
>
>Hi,
>
>I am using XSLT to transfor an XML file to an HTML file. The HTML will
>have a table with certain rows having a gray background and the other
>rows a white background.
>
>For example, the HTML would look like;
>
><html>
> <body>
> <table>
> <tr><td>AAA</td></tr>
> <tr style='background: gray;'><td>BBB</td></tr>
> <tr><td>AAA</td></tr>
> <tr><td>AAA</td></tr>
> <tr><td>AAA</td></tr>
> <tr style='background: gray;'><td>BBB</td></tr>
> <tr style='background: gray;'><td>BBB</td></tr>
> <tr><td>AAA</td></tr>
> </table>
> </body>
></html>
>
>Meaning, I am trying to use choose-when in my XSLT to render either
><tr> or <tr style='background: gray;'>
>
>My code looks like:
>
><xsl:choose>
> <xsl:when test="sometest">
> <tr>
> </xsl:when>
> <xsl:otherwise>
> <tr style='background: gray;'>
> </xsl:otherwise>
></xsl:choose>
>
>The problem is that XSLT expects the <tr>'s to have an ending tag befor
>the when or otherwise tags end. How should I go about implementing this?
>
>Is there any other way to accomplish what I am trying to do?
>
>Thanks,
>HC.
>
>--~------------------------------------------------------------------
>XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
>or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
>--~--
>
>
>--~------------------------------------------------------------------
>XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
>or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
>--~--
>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--