This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: script in xsl, how do I?
- To: <xsl-list at mulberrytech dot com>
- Subject: RE: script in xsl, how do I?
- From: "Chris Bayes" <Chris at Bayes dot co dot uk>
- Date: Mon, 21 Aug 2000 12:15:13 +0100
- Reply-To: xsl-list at mulberrytech dot com
From the SDK that comes with the release
Microsoft XML SDK 3.0 - XSLT Reference
msxsl:script Element
Appears at the top level of the style sheet and contains script blocks that
define global variables and functions for script extensions.
<msxsl:script
language = "language-name"
implements-prefix = "prefix of user's namespace">
</msxsl:script>
Attributes
language
Active Scripting language used for the functions defined within this
element. If left unspecified, the current scripting language is used, as
specified by a language attribute on an ancestor. If no such attribute
exists, JScript® (compatible with ECMA 262 language specification) is used.
This attribute accepts the same values as the language attribute on the HTML
<SCRIPT> element.
implements-prefix
Required. Declares a namespace and associates it with the script block. The
value of this attribute is the prefix which represents the namespace.
Element Information
Number of occurrences Unlimited
Parent elements xsl:stylesheet, xsl:transform
Child elements (No child elements)
Remarks
Belongs to the namespace urn:schemas-microsoft-com:xslt. You can declare
variables and define functions within the <msxsl:script> element. This can
appear within the <xsl:stylesheet> element. A script block thus nested is
treated as a global script block.
You can also instantiate COM objects in the <msxsl:script> element. However,
a user's security settings may prevent your script from instantiating a
client-side object.
Example
This example creates a script block with a namepace prefix of "user" that
contains a function called "xml" that takes a node-list as an argument.
Later, this function is called from the select attribute of <xsl:value-of>.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="http://mycompany.com/mynamespace"
version="1.0">
<msxsl:script language="JScript" implements-prefix="user">
function xml(nodelist) {
return nodelist.nextNode().xml;
}
</msxsl:script>
<xsl:template match="/">
<xsl:value-of select="user:xml(.)"/>
</xsl:template>
</xsl:stylesheet>
See Also
xsl:value-of Element
XML/XSL Portal
http://www.bayes.co.uk/xml
>-----Original Message-----
>From: owner-xsl-list@mulberrytech.com
>[mailto:owner-xsl-list@mulberrytech.com]On Behalf Of e volve
>Sent: 21 August 2000 11:22
>To: XSL-List@mulberrytech.com
>Subject: script in xsl, how do I?
>
>
>using MSXML with the
>xmlns:xsl="http://www.w3.org/TR/WD-xsl"
>declaration, you can use
><xsl:script> and <xsl:eval>
>(I have only been able to get these to work with js and not vbs)
>but my understanding is that this is the poor relation to
>xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>so
>how do i get around this apparent lack of scripting capability?
>
>(
>bearing in mind I am using MSXML parser 3(?) Although the many
>DOMs supplied
>with this are a source of much confusion i.e. that 2.6 is the current
>production release but only dom and dom3.0 work...aaaargh!
>)
>
>
>________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list