xsl-list
[Top] [All Lists]

RE: top level params and xsl:attribute magic?

2003-01-19 13:16:17
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 would have said that was a characteristic of computer programming in
general.

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. 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>

(1) works and (2) doesn't work. With two, I get nothing, empty node 
set. They should be equivalent!

They are completely different. (1) passes the result of evaluating the
expression held in $StartPointStr. (2) attempts to pass a result tree
fragment containing an attribute node whose name is "select" and whose
value is the result of evaluating the expression held in $StartPointStr.
XSLT doesn't allow creation of attribute nodes except when they are
attached to an element, so this should throw an error.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list