xsl-list
[Top] [All Lists]

RE: msxsl:script with VBScript & JavaScript

2002-10-25 07:51:56
For VB, this works:

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="http://mycompany.com/mynamespace";
xmlns:vb_user="http://vb.mycompany.com/mynamespace";>
<msxsl:script language="JavaScript" implements-prefix="user">
        function xml(str)
        {
                return str;
        }
</msxsl:script>
<msxsl:script language="VBScript" implements-prefix="vb_user">
        Function xml(str)
                Set xml = str
        End Function
</msxsl:script>
<xsl:template match="/">
        <xsl:variable name="test"><xsl:value-of
select="//regularcust/name"/></xsl:variable>
           <xsl:value-of select="vb_user:xml($test)"/>
        </xsl:template>
</xsl:stylesheet>


What your msxsl script function is receiving is an IXMLDOMNodeList interface
pointer.  

So, what you're passing into your method call is not a string but a pointer.

To pass it a string, try this:

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="http://mycompany.com/mynamespace";
xmlns:vb_user="http://vb.mycompany.com/mynamespace";>
<msxsl:script language="JavaScript" implements-prefix="user">
        function xml(str)
        {
                return str;
        }
</msxsl:script>
<msxsl:script language="VBScript" implements-prefix="vb_user">
        Function xml(str)
                xml = str
        End Function
</msxsl:script>
<xsl:template match="/">
        <xsl:variable name="test"><xsl:value-of
select="//regularcust/name"/></xsl:variable>
           <xsl:value-of select="vb_user:xml(string($test))"/>
        </xsl:template>
</xsl:stylesheet>

Now, trying the approach that Adam suggested will still pass an
IXMLDOMNodeList to the method, because the "name" is being casted to string
... but, within an xsl:variable.  So, then when you pass that variable into
the method, you are passing in an IXMLDOMNodeList interface pointer.

HTH,
Jeff



-----Original Message-----
From: aruniima(_dot_)chakrabarti(_at_)iflexsolutions(_dot_)com
[mailto:aruniima(_dot_)chakrabarti(_at_)iflexsolutions(_dot_)com]
Sent: Friday, October 5, 2002 10:13 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] msxsl:script with VBScript & JavaScript


No... still the same problem... :(

Regards,
aruniima

 -----Original Message-----
From:   Adam Griffin [mailto:agriffin(_at_)picworld(_dot_)com] 
Sent:   Friday, October 25, 2002 7:23 PM
To:     'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject:        RE: [xsl] msxsl:script with VBScript & JavaScript

You might have passed it a node instead of a string. Try:
<xsl:value-of select="string(//regularcust/name)" />

-adam



-----Original Message-----
From: aruniima(_dot_)chakrabarti(_at_)iflexsolutions(_dot_)com
[mailto:aruniima(_dot_)chakrabarti(_at_)iflexsolutions(_dot_)com]
Sent: Friday, October 25, 2002 9:45 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] msxsl:script with VBScript & JavaScript


Hello everyone,
        I have the following xsl in which I calling a piece of JavaScript...
but if I do the same with VBScript, it does not work.

My xsl...
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="http://mycompany.com/mynamespace";>
<msxsl:script language="JavaScript" implements-prefix="user"> 
        function xml(str)
        {
                return str;
        }
</msxsl:script>

<xsl:template match="/">
        <xsl:variable name="test"><xsl:value-of
select="//regularcust/name"/></xsl:variable>
           <xsl:value-of select="user:xml($test)"/>
        </xsl:template>
</xsl:stylesheet>

this works but I unable to do exactly the same in VBscript
Also I am unable to perform any kind of operation on the string which I pass
to the Script function as it says "unable to convert returned value as a xsl
data type"
 Can somebody help me on this?? Thanks in advance...

Regards,
aruniima

----------------------------------------------------------------------------

This message contains privileged and confidential information and is
intended only for the individual named. If you are not the intended
recepient you should not disseminate, distribute, store, print, copy or
deliver this message. Please notify the sender immediately by e-mail if you
have received this e-mail by mistake and immediately delete this e-mail from
your system.


E-mail transmission cannot be guaranteed to be secure or error-free as
information could be intercepted, corrupted, lost, destroyed, arrive late or
incomplete, or contain viruses. The sender therefore does not accept
liability for any errors or omissions in the contents of this message which
arise as a result of e-mail transmission.  If verification is required
please request a hard-copy version.


--------------------------------------------------------------------------

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

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

This message contains privileged and confidential information and is
intended only for the individual named. If you are not the intended
recepient you should not disseminate, distribute, store, print, copy or
deliver this message. Please notify the sender immediately by e-mail if you
have received this e-mail by mistake and immediately delete this e-mail from
your system.


E-mail transmission cannot be guaranteed to be secure or error-free as
information could be intercepted, corrupted, lost, destroyed, arrive late or
incomplete, or contain viruses. The sender therefore does not accept
liability for any errors or omissions in the contents of this message which
arise as a result of e-mail transmission.  If verification is required
please request a hard-copy version.


--------------------------------------------------------------------------

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

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



<Prev in Thread] Current Thread [Next in Thread>