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

RE: Dynamicaly applying templates from a node-set con

Subject: RE: Dynamicaly applying templates from a node-set containing xpath values - with msxml parser
From: "Matthieu Ricaud" <matthieu.ricaud@xxxxxxx>
Date: Fri, 28 Oct 2005 11:21:26 +0200
dyn evaluate root node
Hi Ragulf,
the <xsl:value-of select="dyn:evaluate($root,$var)"/> with <xsl:variable
name="root" select="/">
works perfectly, in my real problem also !
It looks so obvious now you said it !
Thanks a lot for this good "couple of thoughts" and your explanation,
Have a nice day,
cheers,
Matthieu.

-----Message d'origine-----
De : Ragulf Pickaxe [mailto:ragulf.pickaxe@xxxxxxxxx]
Envoyi : jeudi 27 octobre 2005 23:37
@ : xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Objet : Re:  Dynamicaly applying templates from a node-set
containing xpath values - with msxml parser


Hi again Matthieu,

I have been rereading your mail here, and have a couple of thoughts.

On 10/26/05, Matthieu Ricaud <matthieu.ricaud@xxxxxxx> wrote:
> Thank you for your answer Ragulf !
> I tried :
> <xsl:for-each select="msxsl:node-set($NodeSetXpathNode)/xpath">
>  <xsl:variable name="var" select="'/foo/@bar'"/>
>  <xsl:value-of select="dyn:evaluate(.,$var)"/>
> </xsl:for-each>
> I do not get error message anymore, but unfortunately the template is not
> applied.

Here, I think the problem is, that you are not in the domain of the
document, but rather of the nodeset (contained in
msxsl:node-set($NodeSetXpathNode)/xpath). I think you will have to
shift the contents to the document. Perhaps something link
dyn:evaluate($root,$var)"/> where $root is the root element in the
input document (<xsl:variable name="root" select="/">).

If this works, then the same applies to your real problem.

> and that's it ! I don't get error anymore with this code.
> (actually I don't really see why... maybe select="." select a text node,
> which is not considered as a string ?)

The select="." does not select a text() node, but rather the current
node, which will be the different xpath elements in the nodeset.
Therefore there is a vast difference of writing:
<xsl:variable name="foo" select="'bar'"/> <!-- String with value "bar" -->
<xsl:variable name="foo" select="bar"/> <!-- Element called "bar" -->
That you have when you say select="." is essentially the same as the
latter of the two. Therefore the string conversion is needed.

> Within the node-set iteration, "." represents the iterated node and not
any
> node of the xml tree.
> Is there a way, within the iteration, to come back to another context
node,
> the root of the xml file for example ?

See first part of mail.

I hope this is of some help
Ragulf Pickaxe :-)

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.