xsl-list
[Top] [All Lists]

Re: xsl:function

2003-03-28 14:12:53
Hi Mac,

Yup, very confused. So, here is the bare bones xsl that I am trying.
I'm using the msxml 4.0 processor. There are no files located at
http://magusdesigns.com/namespace. It's sounds like there don't need
to be any file there, right?

You're defining the functions with <func:function> from EXSLT. MSXML
doesn't support any EXSLT extension functions or elements, so it
simply doesn't recognise <func:function> and therefore doesn't create
a function definition in the way a processor that *does* recognise
<func:function> would.

If you want to create a user-defined function in MSXML, you have to
use <msxsl:script> and write the function in
JavaScript/VBScript/JScript. For example:

<xsl:stylesheet version="1.0"
                xmlns:my="http://magusdesigns.com/namespace";
                xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<msxsl:script language="JScript" implements-prefix="my">
  function test() {
    return 1;
  }
</msxsl:script>

<xsl:template match="/">
  <xsl:value-of select="my:test()" />
</xsl:template>

</xsl:stylesheet>

Alternatively, you can use a processor that does support
<func:function> such as Saxon, Xalan, 4XSLT or libxslt.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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



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