This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Using an XSLT value as a HTML parameter
- To: xsl-list at lists dot mulberrytech dot com
- Subject: RE: [xsl] Using an XSLT value as a HTML parameter
- From: Wendell Piez <wapiez at mulberrytech dot com>
- Date: Mon, 17 Sep 2001 12:16:36 -0400
- References: <Pine.LNX.4.31.0109141234240.26666-100000@shaker.worfie.net>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Ender:
At 01:10 PM 9/15/01, Carlos wrote:
>Something like this
>
> <xsl:template match="text">
> <xsl:element name="font">
> <xsl:attribute name="@format">
> <xsl:value-of select="@value"/>
> </xsl:attribe>
> </xsl:element>
> </xsl:template>
>
>I don't know if @format goes with {} or not,
>have a try.
Yes, it does (XSLT 7.1.3).
Also, this code is functionally the same as
<xsl:template match="text">
<font>
<xsl:attribute name="{@format}">
<xsl:value-of select="@value"/>
</xsl:attribute>
[ ... whatever ... ]
</font>
</xsl:template>
Whatever you want inside the font element (you probably want at least an
<xsl:apply-templates/>) comes after the <xsl:attribute> element, which must
come first among its siblings.
This is a perfect application for <xsl:attribute>, which (as we were saying
not long ago) is often used when a literal result attribute (the <font
color="@value"> form) could be used just as well. Here it can't, since you
have to query the document to find the name you want.
(Thanks Carlos.)
Enjoy,
Wendell
======================================================================
Wendell Piez mailto:wapiez@mulberrytech.com
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
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list