RE: [xsl] using variable in mode attribute

Subject: RE: [xsl] using variable in mode attribute
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Fri, 10 Jan 2003 21:37:43 -0000
> I have the following code which does not work.
> if I replace the mode="$BID" with mode="id1" in line 4, it 
> works. so my question is 
> does the mode attribute take a variable?

No, it doesn't.

> if it does not, what should I do?

It depends what you're trying to achieve. For simple cases, use
<xsl:choose>. For more complex situations, look at Dimitre Novatchev's
FXSL approach.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> xml:
> <A>
> 	<B ID="id1"/>
> </A>
> xsl:
> 	<xsl:template match="A">
> 		<xsl:for-each select="B">
> 			<xsl:variable name="BID" select="@ID"/>
> 			<xsl:apply-templates select="self::B" 
> mode="$BID"/>
> 		</xsl:for-each>
> 	</xsl:template>
> 
> 	<xsl:template match="B" mode="id1">
> 		whatever
> 		<xsl:apply-templates select="self::B" mode="table"/>
> 	</xsl:template>
> 
> 	<xsl:template match="B" mode="table">
> 		table
> 	</xsl:template>
> 
> thanks
> 
> Long
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread