Hi,
Currently i am trying to use an xslt to transform xhtml to rtf. This XSLT comes with extension functions in Javascript for string transformations. These functions are defined according to XALAN specification. In the pipeline which uses this xsl XALAN is used for transformation. However when this pipeline is called a NullPointerException is thrown once the processing gets to the part where an extension function is called. I've also tested the xsl in Oxygen debugger with Xalan (2.7.1). And there it works fine. Here are some fragments of the xsl: The header xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:result="http://www.example.com/result" extension-element-prefixes="result" xmlns:xhtml2rtf="http://www.lutecia.info/download/xmlns/xhtml2rtf" version="1.0"> The extension function <lxslt:component prefix="result" elements="rules" functions="RTFEncode"> <lxslt:script lang="javascript"> function RTFEncode() { // Encode text, character by character return('fgf'); } The call to the function <!-- Default Template --> <xsl:template match="text()"> <xsl:param name="preformatted" select="0"/> <xsl:choose> <xsl:when test="$preformatted = '1'"><xsl:value-of select="result:RTFEncode(., string(.), 2)"/></xsl:when> <xsl:when test="$normalize-space = '1'"><xsl:value-of select="result:RTFEncode(., string(normalize-space(.)))"/></xsl:when> <xsl:otherwise><xsl:value-of select="result:RTFEncode(., string(.), $my-normalize-space)"/></xsl:otherwise> </xsl:choose> </xsl:template> And the processor call to use this xsl: <xpl:processor name="oxf:xalan"> <xpl:input name="config" href="/sites/tenderned/resources/xsl/xhtml2rtf.xsl"/> <xpl:input name="data" debug="PDFINPUT"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><title>fg</title></head> <body>Hello World!</body> </html> </xpl:input> <xpl:output name="data" ref="data" debug="RTF"/> </xpl:processor> So please help me find out why this NullPointerException is thrown and how to fix it. Thanks in advance! -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Niek,
We haven't used Xalan here in a long time, so I am not sure how we'll be able to help you with that on the mailing list. I am trying to think of a way you could use Saxon instead of Xalan. You are using a Xalan extension to implement a function in JavaScript? What is that that function doing? Is there something in the Saxon extension that would help you doing that already (http://www.saxonica.com/documentation/extensions/functions.html)? Otherwise, a possibility is to implement that function in Java as a static method, and call it from XSLT ran in Saxon (http://www.saxonica.com/documentation/extensibility/functions/staticmethods.html). Alex |
Alex I am using the xslt from this site. http://www.codeproject.com/KB/HTML/XHTML2RTF.aspx and attached the xsl to this message. As you can see this xsl contains a lot of javascript. To make it working in a Linux environment i tried to convert the extension function to a Xalan type. Which works fine in Oxygen. For now i'll try to convert the javascript to Java or to call Xalan in an alternative manner from Orbeon. |
Administrator
|
Niek,
OK, I see; so using Saxon for this doesn't seem possible. I don't know how much we'll be able to help with this one the mailing list. We'd need to get this running locally and debug it. But I'm just curious: can you quote the first 10 or 20 lines of the exception you are getting? Alex |
In reply to this post by Niek Wesseling
There is not much information contained in the error messages. In Chainsaw the following is logged: ERROR org.orbeon.oxf.processor.transformer.xslt.XSLTTransformer null - Error at line 618, column 47 of oxf:/sites/tenderned/resources/xsl/xhtml2rtf.xsl: null ERROR org.orbeon.oxf.webapp.ProcessorService null - Exception at oxf:/sites/tenderned/resources/xsl/xhtml2rtf.xsl (executing XSLT transformation) In the page simply java.lang.NullPointerException is displayed. |
In reply to this post by Niek Wesseling
In the meantime im glad to be able to tell that I have bypassed this problem by calling Xalan through Java code in a processor (http://www.orbeon.com/ops/doc/processors-java). Which works fine after some small difficulties. |
Administrator
|
Niek,
On Fri, Mar 20, 2009 at 8:07 AM, Niek Wesseling <[hidden email]> wrote: > In the meantime im glad to be able to tell that I have bypassed this problem > by calling Xalan through Java code in a processor > (http://www.orbeon.com/ops/doc/processors-java). Which works fine after some > small difficulties. Excellent; using the Java processor for this was a good idea! Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.com/ Twitter - http://twitter.com/avernet -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |