This is the mail archive of the xsl-list@mulberrytech.com mailing list .
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
The most likely explanation is that the ReverseString class is not on the classpath. Mike Kay > -----Original Message----- > From: owner-xsl-list@lists.mulberrytech.com > [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Gustaf > Liljegren > Sent: 16 October 2001 11:14 > To: XSL List > Subject: [xsl] 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
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |