Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 4th, 2005, 12:45 PM
Registered User
 
Join Date: Nov 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Learning to use extensions to xslt

Hi folks, new to the forum here.

I'm trying to get the hang of useing extensions to XSLT like some of the math setups that are out there and whatnot. My problem is that it seems that no matter what I do, I end up with a "Namespace * does not contain any functions.", with * = whatever namespace I try to use.

I'm playing with the following stylesheet right at the moment, that I snagged from here: http://xslt.com/html/xsl-list/2001-05/msg00028.html

-------------------------------------------------------------

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java">

<xsl:template match="/">
  <xsl:variable name="max" select="10" />
  <xsl:variable name="min" select="4" />
  <xsl:variable name="R" select="java:java.util.Random.new()" />
  <xsl:value-of select="($max -$min) * java:nextDouble($R) + $min" />
</xsl:template>

</xsl:stylesheet>

-------------------------------------------------------------

I won't end up using it as-is, but I'd like to make it work just so that I know that I can make extensions work.

The machine I'm doing the work on... it's Windows 2000 and I think we're using Xalan, though I'm not sure of the version.

As I said, the error I'm getting is "COM Error: Namespace 'http://xml.apache.org/xslt/java' does not contain any functions."

Type slowly and bear with me if I'm getting my terminology wrong. Thanks :)

 
Old November 4th, 2005, 01:31 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

The way you call extension functions is processor-dependent. Find out which processor you are using (call system-property('xsl:vendor')) and look in the documentation for that processor.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old November 4th, 2005, 04:06 PM
Registered User
 
Join Date: Nov 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hmmm... the interesting thing is, the fellow I grabbed this from indicates that it works in Xalan and the pages that I googled also seem to indicate that this works in Xalan. Is there some sort of way maybe to turn the extensions off and on at the processor?

Any Xalan experts out there?

 
Old November 8th, 2005, 04:27 PM
Registered User
 
Join Date: Nov 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

And so I prove myself an idiot first post...

Our setup has two servers, design and live, and due to the fact that our design server is forced to run IIS (to satisfy our CMS) and our live server is forced to run Apache (to satisfy our security people) it turns out that the two servers are using different XSLT processors... how pleasant. Turns out the design server is running MSXML.

With that in mind, I've now made it work. *sigh*






Similar Threads
Thread Thread Starter Forum Replies Last Post
Forum Extensions plb BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 130 November 24th, 2009 07:10 PM
AJAX Extensions ilegend .NET Framework 3.5 1 September 19th, 2008 03:32 AM
Some Extensions plb BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 July 29th, 2008 11:57 AM
PHP Extensions Dnigma Pro PHP 0 June 22nd, 2006 12:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.