This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Using tags within tags
- To: xsl-list at mulberrytech dot com
- Subject: RE: Using tags within tags
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Wed, 16 Aug 2000 22:05:19 +0100
- References: <7784D3376646D311B082000021CF26243F830F@PIKE>
- Reply-To: xsl-list at mulberrytech dot com
At 19:58 16/08/00 -0200, David Allouche wrote:
>On Wed, 16 Aug 2000, Ben Robb wrote:
>> <xsl:template match="cap">
>> <div>
>> <xsl:attribute name="style">
>> color:<xsl:value-of select="@color"/>
>> </xsl:attribute>
>> <xsl:apply-templates/>
>> </div>
>> </xsl:template>
>
>The <xsl:attribute> would produce nicer output this way:
>(and there was a cultural typo, @color instead of @colour)
>
> <xsl:attribute name="style">
> <xsl:text/>color:<xsl:value-of select="@colour"/>
> </xsl:attribute>
Or, for something as simple as this, you could use an attribute value
template, which is shorter as well as getting rid of whitespace, but a
little less transparent (possibly? - I personally find it easier to read)
and won't work on early versions of MSXML:
<xsl:template match="cap">
<div style="color:{@colour}">
<xsl:apply-templates />
</div>
</xsl:template>
I do like the <xsl:text/> trick :)
Cheers,
Jeni
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list