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

Re: top level params and xsl:attribute magic?

Subject: Re: top level params and xsl:attribute magic?
From: Mike Brown <mike@xxxxxxxx>
Date: Sat, 18 Jan 2003 00:21:53 -0700 (MST)
libxslt top level param
S Woodside wrote:
> I'm beginning to think that XSLT is a bit like magic. If you think the 
> right way, and use the right magic incantation, it works like a charm. 
> If you don't, no cigar.
> 
> I have this top-level param to grab a param from http:
>    <xsl:param name="StartPointStr">.</xsl:param>
> 
> The param StartPointStr is an Xpath string.

...unless it wasn't supplied, in which case it is a result tree fragment
consisting of a root node with a text node child, the text node encapsulating
a period character. You probably intended for it to be just a string:

   <xsl:param name="StartPointStr" select="'.'"/>

> Next I have this (which works) (1)
>    <xsl:param name="StartNode" select="dyn:evaluate($StartPointStr)"/>
> 
> Compare to this (which doesn't work): (2)
>    <xsl:param name="StartNode">
>          <xsl:attribute name="select">
>            <xsl:value-of select="dyn:evaluate($StartPointStr)"/>
>          </xsl:attribute>
>    </xsl:param>

xsl:attribute adds an attribute to an element node that has been created
*in the result tree*, not in the stylesheet tree.

If you had put a literal result element in the stylesheet, it would
have been copied through to the result tree, along with the generated 
attribute added to it.

> LibXSLT doesn't complain

In the section of the spec that describes xsl:attribute, it says "Adding an
attribute to a node that is not an element [is an error]; implementations may
either signal the error or ignore the attribute."  LibXSLT is free to ignore 
it.

Mike

-- 
  Mike J. Brown   |  http://skew.org/~mike/resume/
  Denver, CO, USA |  http://skew.org/xml/

 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.