Subject: RE: XSL : template for attribute From: David Schach <davidsch@xxxxxxxxxxxxx> Date: Wed, 28 Apr 1999 09:15:12 -0700 |
> 2. If I tried to write template for this attribute , > it doesn't work correctly - it each time goes to the " otherwise" case . > What wrong here ? > > <xsl:template match="Field"> > <p > > <xsl:apply-templates select="@colr"/> > <xsl:apply-templates /> > </p> > </xsl:template> > > <xsl:template match="@colr"> > <xsl:attribute name="STYLE">color: > <xsl:choose> > <xsl:when test="@colr[.='2']">white</xsl:when > > <xsl:when test="@colr[.='0']">green</xsl:when > > <xsl:otherwise >black</xsl:otherwise > > </xsl:choose> > </xsl:attribute> > </xsl:template> > [David] Because the attribute is already the current node, the template needs to be written as <xsl:template match="@colr"> <xsl:attribute name="STYLE">color: <xsl:choose> <xsl:when test=".[.='2']">white</xsl:when > <xsl:when test=".[.='0']">green</xsl:when > <xsl:otherwise >black</xsl:otherwise > </xsl:choose> </xsl:attribute> </xsl:template> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
XSL : template for attribute, Chanukov Orit | Thread | RE: XSL : template for attribute, Kay Michael |
XSL : template for attribute, Chanukov Orit | Date | Re: XSL is difficult to...?, Sara Mitchell |
Month |