|
|
Rank: Newbie
Joined: 5/15/2006 Posts: 5 Location: Colombia
|
Hi,
StyleVision 2010 is great for designing print documents thanks to Absolute positioning and User Defined Elements.
I´m just using User Defined Elements to generate barcodes using Barcode4J and FOP, only with XSLT 1.0 because FOP doesn{t support XSLT 2.0
The only drawback is that the PDF preview in StyleVision uses XSLT 2.0 and I get the following message when using Barcode$J:
Error in XPath expression Line 1582, Character 28
(Unknown function - Name and number of arguments do not match any function signature in the static context - 'org.krysalis.barcode4j.xalan.BarcodeExt:generate')
in expression
select="barcode:generate($barcode-cfg,$codigo)"
Is there any way of making StyleVision work with Barcode4J in the PDF preview?
Thanks everybody!
|
|
Rank: Newbie
Joined: 10/28/2002 Posts: 1,283 Location: AT
|
Hi,
it has nothing to do with xslt 1.0 or xslt 2.0, it has to with the fact that the xslt processor has to know where to find the definition for the function so that it can use it. Please take a look at the extension function section of the documentation which explains the mechanism:
http://manual.altova.com/Stylevision/stylevisionenterprise/xextextensions.htm
BTW: Apache FOP calls an external java xslt engine to do the xml to fo part of the transformation. The external engine only supports xslt 1.0. You can STILL use xslt 2.0 though! Simply use an xslt 2.0 engine to transform the xml into fo and then let FOP render the fo file into pdf. AltovaXML is a free xslt engine (which supports both xslt 1.0 and xslt 2.0) which you can use to do the first part of the transformation i.e. xml to fo. This way you can have the power of xslt 2.0 at your disposal:
https://www.altova.com/altovaxml.html
|
|
Rank: Newbie
Joined: 5/15/2006 Posts: 5 Location: Colombia
|
Thanks for your response.
Looking at the documentation of the Java Extensions, I see a potential conflict between the definition of namespace in Altova and FOP.
To use the extension in FOP, I just declare the namespace with the class name, like this:
<fo:instream-foreign-object xmlns:barcode="org.krysalis.barcode4j.xalan.BarcodeExt" >
And just make sure to put the file barcode4j-fop-ext.jar in the CLASSPATH.
But in Altova, the declaration will look like this:
<fo:instream-foreign-object xmlns:barcode="java:org.krysalis.barcode4j.xalan.BarcodeExt?path=jar:file:///c:/jars/barcode4j-fop-ext.jar!/" >
Totally incompatible with the FOP syntax.
And a last question: If I don´t use the full path to the file (file:///c:/jars/barcode4j-fop-ext.jar), does Altova look in the classpath.
Thank you very much for the help.
|
|
Rank: Advanced Member
Joined: 7/17/2008 Posts: 185 Location: Minutiae, Triviality
|
Hi,
The Altova version of the java extension syntax is part of the first stage. The java will be executed as part of the .xsl transform and the result itself will be contained in the .fo file that is the result of the xsl transform.
In other words, by the time that FOP happens, there isn't any java extensions left, so the "fop syntax" for a java-extension-in-FOP is irrelevant.
I believe that AltovaXML, StyleVision, etc make no use of the CLASSPATH. You have to have paths (full or relative from the location of the .sps file?) that point at the .jar or .class file you are using.
|
|
|
guest |