xsl-list
[Top] [All Lists]

Re: [xsl] Help creating and calling xsl:functions

2006-03-31 10:53:56
----- Original Message ----- From: "William Scarvie" <wscarvie(_at_)hotmail(_dot_)com>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Friday, March 31, 2006 6:45 PM
Subject: [xsl] Help creating and calling xsl:functions


Hi all,

I'm having trouble getting even basic uses of xsl:function to work in my browsers. I'm using this sample code, from http://www.xml.com/lpt/a/2003/09/03/trxml.html:

<xsl:stylesheet version="2.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 xmlns:foo="http://whatever";>

 <!-- Compare two strings ignoring case, returning same
      values as compare(). -->
 <xsl:function name="foo:compareCI">
   <xsl:param name="string1"/>
   <xsl:param name="string2"/>
<xsl:value-of select="compare(upper-case($string1),upper-case($string2))"/>
 </xsl:function>

 <xsl:template match="/">
compareCI red,blue: <xsl:value-of select="foo:compareCI('red','blue')"/>
compareCI red,red: <xsl:value-of select="foo:compareCI('red','red')"/>
compareCI red,Red: <xsl:value-of select="foo:compareCI('red','Red')"/>
compareCI red,Yellow: <xsl:value-of select="foo:compareCI('red','Yellow')"/>
 </xsl:template>

</xsl:stylesheet>

I create a "dummy" XML document, using this stylesheet, as follows:

<?xml version="1.0" ?>

<?xml-stylesheet type="text/xsl" href="fn_test.xsl" ?>

<test_tag>Nothing to see here</test_tag>

When using Firefox 1.5.0.1, I get the following error when I try to open the XML file in the browser:

Error during XSLT transformation: An unknown XPath extension function was called.

When using IE 6.0, I get the following error:

         Namespace 'http://whatever' does not contain any functions.

Any idea why I'm not getting function calls to work?

Thanks in advance,

Will



Neither IE nor Firefox support version XSLT 2.0.
One way to do this would be to transform using Saxon, either Java or .NET, possibly on the server.

Joe
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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