This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Using an XSLT value as a HTML parameter


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]