Subject: [xsl] How to call an external Java function From: "Ylvisaker, Steve" <steve.j.ylvisaker@xxxxxxxxxxxxx> Date: Thu, 8 Jan 2009 13:42:06 -0600 |
I have a working Java function that uses FontMetrics to determine the length in points of a given character stream. I am able to call the function from the windows command line and it runs just as I expect. Now I want to call that same function from my XSL stylesheet and I can't seem to get the correct incantation. I have set my classpath environment variable to include the path: c:\maps-jars\FontWidth.jar I have placed FontWidth.jar in folder c:\maps-jars FontWidth is the Java class. And I have run the following simple transformation with Saxon8: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:med="java:FontWidth" extension-element-prefixes="med"> <xsl:template match="/"> <xsl:variable name="testJava"> <xsl:value-of select="med:labelStringWidth('Helvetica World', 12, 'This is test text')"/> </xsl:variable> <xsl:message>result:<xsl:value-of select="$testJava"/></xsl:message> </xsl:template> </xsl:stylesheet> labelStringWidth is a method belonging to class FontWidth. I have run this under <oxygen/> and stand alone from the command line with Saxon8 and in both situations I receive the following error message: Description: XPath syntax error at char 64 on line 11 in {...rld', 12, 'This is test tex...}: Cannot find a matching 3-argument function named {java:FontWidth}labelStringWidth() Any help I can get on this would be very much appreciated. Steve [CONFIDENTIALITY AND PRIVACY NOTICE] Information transmitted by this email is proprietary to Medtronic and is intended for use only by the individual or entity to which it is addressed, and may contain information that is private, privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please delete this mail from your records. To view this notice in other languages you can either select the following link or manually copy and paste the link into the address bar of a web browser: http://emaildisclaimer.medtronic.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] flattening an xml hierarc, Vasu Chakkera | Thread | Re: [xsl] How to call an external J, Florent Georges |
Re: [xsl] flattening an xml hierarc, David Carlisle | Date | Re: [xsl] How to call an external J, Florent Georges |
Month |