I've used the example code in the class ExampleXML2PDF from the FOP 0.95
distribution to see what fop can do.
I'm trying to write a java extension function for the stylesheet and in the
function return a org.w3c.dom.Node element. My problem is, i cannot find a
easy way to construct such an object.
My java function has the following signature: public static Node
method(ExpressionContext e, Node n, <more params>)
And i correctly recieve an ExpressionContext and Node of type
org.apache.xpath.XPathContext$XPathExpressionContext and
org.apache.xml.dtm.ref.DTMNodeProxy.
The method n.getOwnerDocument().createElement("block"); throws an exception
since the owner document does not support any of the createX methods.
I've written my own class the implements org.w3c.dom.Element and it works,
but its a lot of code for something that ought to be supported by something
in the extension.The reason for this "madness" is that i've made a java function which is able to calculate tab stops using the FOP event handlers FontInfo class (((org.apache.fop.fo.FOTreeBuilder) fop.getDefaultHandler()).getEventHandler()). Using the fontInfo class one can get access to the fontmetrics of the font used to render a given PDF document, thereby calculating the length of a word before a tabstop. My goal is to create som fo:block and fo:leader elements with the text where tabs stop has been replaced by fo:leader elements. If i just return the String "<fo:block>some text</fo:block>" the output is escape. -- View this message in context: http://www.nabble.com/xsl-fo-java-extension-function-tp23745283p23745283.html Sent from the FOP - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
