[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: call-template and execute xsl command

Subject: RE: call-template and execute xsl command
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Mon, 15 Apr 2002 20:04:43 +0100
xsl commands list
You can't add attributes to an element after adding a text node. This is so
that XSLT processors are able to operate serially.

What you are trying to do is effectively:

<xsl:element name="e">
  text
  <xsl:attribute name="a">5</xsl:attribute>
</xsl:element>

A processor trying to output
<e a="5">text</e>

would have to delay outputting the "text" until it was sure there were no
attributes to be added.

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

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Eric Smith
> Sent: 15 April 2002 18:27
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  call-template and execute xsl command
>
>
> Hi
>
> I have a named template of the following form:
>
>
> <xsl:template name= "attributes">
>     <xsl:choose>
>      <xsl:when test="@font-size">
>       <xsl:attribute name="font-size"><xsl:value-of
> select="@font-size"/></xsl:attribute>
>      </xsl:when>
>      <xsl:when test="@text-align">
>       This text prints out if @text-align but the xsl:command
> is not executed
>       <xsl:attribute name="text-align"><xsl:value-of
> select="@text-align"/></xsl:attribute>
>      </xsl:when>
>     </xsl:choose>
>   </xsl:template>
>
> called like this:
>  <xsl:variable name='y'>
>    <xsl:call-template name='attributes'/>
>  </xsl:variable>
>
> However, as you may see by my notes above, text prints out fine
> subject to the condition, however I cannot change or add
> attributes as required.
>
> Any suggestions?
>
> thanx
>
> --
> Eric Smith
>
>  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.