[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Saxon custom extensions problem

Subject: RE: Saxon custom extensions problem
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Tue, 16 Oct 2001 13:19:33 +0100
saxon extension source
The most likely explanation is that the ReverseString class is not on the
classpath.

Mike Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Gustaf
> Liljegren
> Sent: 16 October 2001 11:14
> To: XSL List
> Subject:  Saxon custom extensions problem
>
>
> Finally upgraded to Saxon 6.4.3. :-)
>
> Now I have some questions on the documentation for custom
> extensions to
> Saxon, namely the extensibility.html document:
>
>  'With the short-cut technique, the URI for the namespace identifies
>   the class where the external function will be found. The namespace
>   URI must either be "java:" followed by the fully-qualified class
>   name (for example xmlns:date="java:java.util.Date"), [...] The class
>   must be on the classpath.'
>
> Okay, here's my custom Java extension function:
>
> class ReverseString {
>   public static String reverseIt(String source) {
>     int i, len = source.length();
>     StringBuffer dest = new StringBuffer(len);
>     for (i = (len - 1); i >= 0; i--) {
>       dest.append(source.charAt(i));
>     }
>     return dest.toString();
>   }
> }
>
> I can take Java syntax, but I'm not so familiar with terminology like
> "fully-qualified class name". I have no class library, just a single
> function, and in the same directory as the stylesheet. So if
> I want to use
> it as an extension for an FO transformation, I guess I should write:
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet version="1.0"
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   xmlns:fo="http://www.w3.org/1999/XSL/Format"
>   xmlns:my="java:ReverseString">
>
> And later on, I use it like this:
>
> <xsl:value-of select="my:reverseIt(.)"/>
>
> Something is clearly wrong, and it seems to happen at the namespace
> declaration already:
>
>   The URI java:ReverseString does not identify an external Java class
> Transformation failed: run-time errors were reported
>
> For the future, it would be helpful to include two tiny (but complete)
> examples in the documentation: one for importing, and another
> for exporting
> content from the stylesheet to a Java application.
>
> Gustaf Liljegren
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.