[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Question about HTML tags

Subject: RE: Question about HTML tags
From: "Scott Trenda" <Scott.Trenda@xxxxxxxx>
Date: Wed, 3 Oct 2007 15:51:21 -0500
RE:  Question about HTML tags
<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@xxxxxxxxx]
Sent: Wednesday, October 03, 2007 3:48 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  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.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.