[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
xsl:choose to define conditional attributes?
Subject: xsl:choose to define conditional attributes? From: oberthier@xxxxxxxxxxxx Date: Thu, 30 Sep 1999 21:02:16 +0100 (CET) |
I'm currently trying to define some conditional processing in order to be able to derive different values for some attributes thanks to <xsl:choose> and <xsl:when>. For instance, using the transformation to generate some HTML, and a <LABEL> tag in the example below, I'd like to do something like the following: <label> <xsl:attribute name="id">myLabelId</xsl:attribute> <xsl:choose> <xsl:when test=". = ''"> <xsl:attribute name="style">MyStyleEmpty</xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="style">MyStyleFull</xsl:attribute> </xsl:otherwise> </xsl:choose> The Label </label> generating: <label id="myLabelId" style="MyStyleEmpty">The Label</label> when the content of the element selected is null, and: <label id="myLabelId" style="MyStyleFull">The Label</label> when it's populated with some data. However the above XSL doesn't seem to work. I suspect it is because the XSLT WD states that it should be used for templates only. Ok, but then, how to implement this type of conditional processing (and thus to avoid duplicating the whole definition of the LABEL tag)? Thanks for your help, Olivier. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
XSL processor to handle large Datab, Chuck Love | Thread | RE: choose to define conditional at, Mike Brown |
XSL processor to handle large Datab, Chuck Love | Date | RE: choose to define conditional at, Mike Brown |
Month |