Subject: Re: [xsl] Something similar to managing behavior with a variable From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 05 Apr 2005 13:54:24 -0400 |
<xsl:for-each select="$nodes"> <xsl:if test="$condition"> ... </xsl:if> ... </xsl:for-each>
<xsl:for-each select="$nodes[$condition]"> ... </xsl:for-each>
Cheers, Wendell
Hello;
I'm creating a UI that writes rows of data. The background of the row needs to changes every second row. I was doing it like this:
<tr align="left" valign="middle" class="grey1ColumnText"> <xsl:choose> <xsl:when test='number($position) mod 2 != 0'> <xsl:attribute name="class">grey1ColumnText</xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="class">grey2ColumnText</xsl:attribute> </xsl:otherwise> </xsl:choose> </tr>
My problem now is now have a condition that determines when a row is to be written. So, in a collection of 5 items maybe only 1 and 4 get written. I still need a way to figure out how to alternate the background for the rows that actually get written. Position no longer does the trick.
I thought I could keep the previous background in a variable like below:
<tr align="left" valign="middle" class="grey1ColumnText"> <xsl:choose> <xsl:when test="$resultBK = 'grey1ColumnText'"> <xsl:attribute name="class">grey2ColumnText</xsl:attribute> <xsl:variable name="resultBK" select="string('grey2ColumnText')"/> </xsl:when> <xsl:otherwise> <xsl:attribute name="class">grey1ColumnText</xsl:attribute> <xsl:variable name="resultBK" select="string('grey1ColumnText')"/> </xsl:otherwise> </xsl:choose> </tr>
But I have just found out you can't change the contents of a global variable (resultBK) after it has been defined. How can I handle this?
Thanks,
Luke
Luke Shannon | Software Developer FutureBrand Toronto
207 Queen's Quay, Suite 400 Toronto, ON, M5J 1A7 416 642 7935 (office)
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Something similar to managing, Luke Shannon | Thread | Re: [xsl] Something similar to mana, Luke Shannon |
RE: [xsl] math return result probl, Michael Kay | Date | [xsl] Something similar to managing, Luke Shannon |
Month |