[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: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Fri, 17 Jan 2003 23:08:51 -0800 (PST)
xsl params
First, I would stroongly recommend *not* to use any xx:evaluate
function.

As anyway you are passing the XPath expression through a global
xsl:param (which is done outside of XSLT processing, using some kind of
API), it would be much better to set the value of the "select"
attribute of this particular xsl:param (again through the API (most
probably XML DOM)) to the string/XPath-expression.

This is both simple and efficient, it completely eliminates your
current problem.

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

In the snippet above you're specifying the value of the "select"
attribute to the *string* value of the *first* node in the node-set
returned by dyn:eveluate().

This, of course, is completely different to setting the "select"
attribute to the node-set.

Once again, the best way in your situation is to forget about extension
functions and to set the "select" attribute totally from outside and
just before the start of the transformation.

This is the way the XPath Visualiser (both for IE and Mozilla) works --
do have a look at its code.


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL



"S Woodside" <sbwoodside@xxxxxxxxx> wrote in message
news:F2CC80BE-2AA0-11D7-8385-000393414368@xxxxxxxxxxxx
> 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. 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!
> 
> OK, wait, I see in the spec "The xsl:attribute element can be used to

> add attributes to result elements" ... so this must be an illegal use

> of xsl:attribute. But LibXSLT doesn't complain ... maybe this is just
a 
> case of inadequate error detection and reporting the in the 
> implementation (I used to see that very often in C++ compilers...)
> 
> simon
> 
> ---
> www.simonwoodside.com
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

 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.