[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Portability function-available tips


Subject: Re: [xsl] Portability function-available tips
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 9 Jan 2004 13:04:14 GMT

I wrote


    <msxsl:script language="JScript" implements-prefix="exsl">
       function node-set(r) {
    some javascript to return the thing cast to a node set
    which I'm sure you can do but don't have the doc to hand
    }
    </msxsl:script>
    

which isn't entirely true: you could define such a function but
you can't call it node-set as jscript functions can't have - in their
names, and if you call it anything else it doesn't really help.

So you can use the same trick in the other direction: use msxsl:node-set,
and that works natively on msxsl and for exslt processors define that
function using exsltf:function, the following has been tested (for a
change)

As Dimitre has said (and I said in my initial reply) if you are in a
situation where downloading a 3rd party extension to the processor is
OK, a better solution would be to use the msxml4 exslt implementation.

David




<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="set.xsl"?>
<xsl:stylesheet version="1.0"   
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exslt="http://exslt.org/common"
xmlns:exsltf="http://exslt.org/functions"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
extension-element-prefixes="exslt exsltf  msxsl"
>

<xsl:variable name="x">
<x>
 <a/>
 <b/>
 <c/>
</x>
</xsl:variable>

<exsltf:function name="msxsl:node-set">
<xsl:param name="x"/>
<exsltf:result select="exslt:node-set($x)"/>
</exsltf:function>

<xsl:template match="/">
[[[<xsl:value-of select="name(msxsl:node-set($x)/*/*[2])"/>]]]
</xsl:template>

</xsl:stylesheet>



-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. 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
________________________________________________________________________

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



Current Thread