RE: [xsl] problem using dyn:evaluate with MSXML

Subject: RE: [xsl] problem using dyn:evaluate with MSXML
From: "Matthieu Ricaud" <matthieu.ricaud@xxxxxxx>
Date: Thu, 16 Dec 2004 16:37:21 +0100
Thanks a lot David for your ultra quick response !!
It works perfectly :)


-----Message d'origine-----
De : David Carlisle [mailto:davidc@xxxxxxxxx]
Envoyi : jeudi 16 dicembre 2004 16:15
@ : xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Objet : Re: [xsl] problem using dyn:evaluate with MSXML



	<xsl:variable name="y" select"'@my_attribute'">
   The problem I have is that when I define $y like this :

	<xsl:variable name="y">@num</xsl:variable>

  (Which is to me exactly the same definition as before)

The two ways of using xsl:variable are not equivalent and in general
you should always use the first version with select= unless you really
need to create a result tree.

With the first $y has type string and so presumably is converted to a
string in the javascript when you pass it to the msxsl script.

In the second $y has type result tree fragment, which is more or less
the same type as node set (it is a document node, with a text node
child), that almost certainly is passed to the script as an MS DOM
document node, which probably is not the type that the javascript
function was expecting.

If you have to use the second form, make sure it's a string before
passing it over to the MS script engine by using
  dyn:evaluate(., string($y))
                  ^^^^^^^  ^
                  ^^^^^^^  ^

(untested)

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread