Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

namespace extensions

12 views
Skip to first unread message

bertels...@telenet.be

unread,
Apr 7, 2005, 7:38:41 AM4/7/05
to
Hi,

i'm struggling with the following problem.
I've created an xsl file to transform my xml but need javascript functions to display certain values in a specific way.

Until now I've only tried to view the site using IE6.x (I know I know...)
but I need to be able to get it working in FireFox as well...

Now here's the problem:

I use an extension in xsl to be able to run javascript (namespace extension) :
namespace = xmlns:msxsl="ur:schemas-microsoft-com:xslt" ...

I was wondering ... is there an equivalent that I could use for the Mozilla/FireFox browser??

Let me list an example as I'm using it now:

<xml><dvd title="TestTitle"></xml>

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

<msxsl:script language="javascript" implements-prefix="xslscript">
<![CDATA[
function toUpper(value) {
return value != null ? value.toUpperCase() : "";
}
]]>
</msxsl:script>

<xsl:template match="/">
<html>
<body>
<xsl:value-of select="xslsript:toUpper(string(dvd/@title))"/>
</body>
</html>
</xsl:template>

</xsl:stylesheet>


IE: works fine
FireFox: Error During XSLT transformation: An unknow XPath extension function was called. -> Leaving out the call to the xslscript:toUpper transforms the xml (without the desired functionality)


If reply-ing to this mail, please keep in mind that this is just an example. In the real application, I need to use some serious JavaScript and not just a toUpperCase ;)


So?
Does anybody know how I can fix this?

Thanks in Advance,
Greetz, LeS.

Martin Honnen

unread,
Apr 7, 2005, 8:25:24 AM4/7/05
to

bertels...@pandora.be wrote:


> i'm struggling with the following problem.
> I've created an xsl file to transform my xml but need javascript functions to display certain values in a specific way.
>

> I use an extension in xsl to be able to run javascript (namespace extension) :


> namespace = xmlns:msxsl="ur:schemas-microsoft-com:xslt" ...
>
> I was wondering ... is there an equivalent that I could use for the Mozilla/FireFox browser??

No, there is no script support inside of XSLT 1.0 transformations in
Mozilla. But you can pass in parameters before the transformation if you
run the whole transformation with script.

> Let me list an example as I'm using it now:
>
> <xml><dvd title="TestTitle"></xml>
>
> <xsl:stylesheet
> version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:msxsl="urn:schemas-microsoft-com:xslt"
> xmlns:xslscript="myJavaScript">
>
> <msxsl:script language="javascript" implements-prefix="xslscript">
> <![CDATA[
> function toUpper(value) {
> return value != null ? value.toUpperCase() : "";
> }
> ]]>
> </msxsl:script>
>
> <xsl:template match="/">
> <html>
> <body>
> <xsl:value-of select="xslsript:toUpper(string(dvd/@title))"/>
> </body>
> </html>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
> IE: works fine
> FireFox: Error During XSLT transformation: An unknow XPath extension function was called. -> Leaving out the call to the xslscript:toUpper transforms the xml (without the desired functionality)

You can avoid an error if you use a proprietary extension function by
checking
<xsl:if test="function-available('xslsript:toUpper')">


<xsl:value-of select="xslsript:toUpper(string(dvd/@title))" />

</xsl:if>
That will avoid the error you get so far but of course if will not give
you the script functionality you are looking for.


--

Martin Honnen
http://JavaScript.FAQTs.com/

Benoit Thierry

unread,
Nov 20, 2006, 5:05:00 PM11/20/06
to

Hi, I'm having the same problem.

So I 'd like to know if you have found a solution in order to be able to insert script inside xsl file, under FireFox/mozilla ?

Thanks in advance.

Ben

BizTalk Utilities - Frustration free BizTalk Adapters
http://www.topxml.com/biztalkutilities

0 new messages