xsl-list
[Top] [All Lists]

RE: Dynamicaly applying templates from a node-set containing xpath values - with msxml parser

2005-10-28 02:21:26
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(_dot_)pickaxe(_at_)gmail(_dot_)com]
Envoyé : jeudi 27 octobre 2005 23:37
À : xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Objet : Re: [xsl] 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(_dot_)ricaud(_at_)cned(_dot_)fr> 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 :-)

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--