Title: RE: Rép. : RE: Rép. : xsltc trax transformer problems

Thanks a lot - we have some progress!!

That proved really helpful, I think....

I passed in my XML document and my xsl:fo, and this is the error message:


Exception in thread "main" java.lang.ClassFormatError: translet_out (Code of a method longer than 65535 bytes)

        at java.lang.ClassLoader.defineClass0(Native Method)

        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)

        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)

        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)

        at org.apache.xml.utils.ObjectFactory.findProviderClass(ObjectFactory.java:387)

        at org.apache.xalan.xsltc.cmdline.Transform.doTransform(Transform.java:135)

        at org.apache.xalan.xsltc.cmdline.Transform.main(Transform.java:323)

Might this be because we have a monstrous node in my xsl (there would be several), and would that be solved by breaking it up into templates??

I'd love to have simple example of how to do that, we've not managed to do that with an xsl:fo yet, because we want to extract tables or parts of tables, and we're not allowed to parse that for some reason. The Parser complains about the fo:table element not being bound


The xsl I've used for testing to include templates

<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:decimal-format name="standard" decimal-separator="," grouping-separator="." infinity="INFINITY" minus-sign="-" NaN="ogiltigt nummer" percent="%" per-mille="m" zero-digit="0" digit="#" pattern-separator=";"/>

<xsl:template match="/">

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

        <fo:layout-master-set>

        <fo:simple-page-master master-name="content"

                margin-right="5mm" margin-left="5mm"

                        margin-bottom="5mm" margin-top="5mm"

                page-width="210mm" page-height="297mm">

                <fo:region-body margin-top="20mm" margin-bottom="20mm"/>

                <fo:region-before extent="20mm"/>

                <fo:region-after extent="20mm"/>

        </fo:simple-page-master>

        </fo:layout-master-set>

        <fo:page-sequence master-reference="content">

                <fo:flow flow-name="xsl-region-body">

                        <fo:table table-layout="fixed" inline-progression-dimension.optimum="200mm" font-size="10px">

                                <fo:table-column column-width="200mm" column-number="1" />

                                <fo:table-body start-indent="0px" text-align="start">

                                        <fo:table-row>

                                                <fo:table-cell>

                                                <xsl:apply-templates select="tableTest" mode="blind"/>

                                        </fo:table-cell>

                                        </fo:table-row>

                                </fo:table-body>

                </fo:table>            

                </fo:flow>

        </fo:page-sequence>

</fo:root>

</xsl:template>

<xsl:template match="tableTest" mode="blind">

   <fo:table table-layout="fixed" width="100%">

      <fo:table-column column-width="proportional-column-width(1)"/>

      <fo:table-body>

         <fo:table-row padding-bottom="0.5em">

            <fo:table-cell>

               <fo:block font-family="Times Roman"

                         font-style="italic"

                         font-size="8pt">

                         TEST

               </fo:block>

            </fo:table-cell>

         </fo:table-row>

         <fo:table-row keep-with-previous="always">

            <fo:table-cell>

               <fo:block>

                  TEST

                </fo:block>

            </fo:table-cell>

         </fo:table-row>

     </fo:table-body>

  </fo:table>

</xsl:template>

</xsl:stylesheet> 

Regards

/Johan

-----Original Message-----
From: Willy Reinhardt [mailto:[EMAIL PROTECTED]]
Sent: den 2 december 2005 13:37
To: Elmström Johan; fop-user@xml.apache.org; fop-users@xmlgraphics.apache.org
Subject: Rép. : RE: Rép. : xsltc trax transformer problems

Find below a batch script  which I use to call xsltc processor for testing.

It is for Windows but for a Unix it would be similar.

>>>>>>>>>>>>>>>>

@echo off

REM Script pour l'appel du processur XSLTC en ligne de commande

REM Les librairies XSLTC doivent être soit dans le classpath ou dans le répertoire endorsed de votre jvm

REM Documentaion XSLTC voir: http://xml.apache.org/xalan-j/xsltc_usage.html

REM Exemple: >xsltc.bat .\src\test.xml .\out\test.html .\xsl\test.xsl

REM Version 1.0 W.Reinhardt 27.09.2005

echo source file = %1

echo output file = %2

echo XSL file = %3

echo JAVA_HOME = %JAVA_HOME%

echo CLASSPATH = %CLASSPATH%

echo efface translet...

if exist translet_out.class del translet_out.class

echo compile...

%JAVA_HOME%\bin\java -cp %CLASSPATH% org.apache.xalan.xsltc.cmdline.Compile -o translet_out %3

echo transforme...

%JAVA_HOME%\bin\java -cp %CLASSPATH% org.apache.xalan.xsltc.cmdline.Transform %1 translet_out > %2

<<<<<<<<<<<<<<<<<<<<<<

Willy





----------------------------------- 

Cambridge Technology and Partners

Willy Reinhardt

Air Center

Ch. des coquelicots 16

CH-1214 Vernier

Phone: +41 22 306 47 24

Fax: +41 22 306 47 47

http://www.ctp.com

http://www.novell.com/open

>>> Elmström Johan <[EMAIL PROTECTED]>  >>>

Thanks for the quick reply!

I've suspected that too, but since I haven't gotten any parser errors, I haven't checked that out too much.

The problem is when I create a test app, I get an exception, 'could not instantiate translet 'GregorSamsa' I believe I've included all the jars Trax specifies (xsltc, xalan, xercesImpl, xml-apis, serializer and xmlParserAPIs .jars). This does not occur on the server though.

Any suggestions on this?

Regards

/Johan

-----Original Message-----

From: Willy Reinhardt [mailto:[EMAIL PROTECTED]]

Sent: den 2 december 2005 12:18

To: Elmström Johan; fop-user@xml.apache.org; fop-users@xmlgraphics.apache.org

Subject: Rép. : xsltc trax transformer problems

Hi,

Maybe your problem is aound xalan and not FOP. But we had similar issues

when we switch from xslt to xsltc. xsltc is a bit more sensitive but

often the issue is a "bug" into xsl.

My advice is:

- Test and migrate your xsl using Xalan xsltc only and then use fop.

Concerning Weblogic, I noted it become unstable when a

NullPointerException occur and we also need to restart instance.

Willy




----------------------------------- 

Cambridge Technology and Partners

Willy Reinhardt

Air Center

Ch. des coquelicots 16

CH-1214 Vernier

Phone: +41 22 306 47 24

Fax: +41 22 306 47 47

http://www.ctp.com

http://www.novell.com/open

>>> [EMAIL PROTECTED]  >>>

Hi All

 

I'm getting a really confusing error when trying to generate a standard

PDF file.

 

When I'm using the exact same XML and XSL:FO with two different

transformers I get what I want with one (standard xalan transformer) but

with the other (xalan xsltc.trax transformer) FOP just hangs and kills

the appserver (BEA Weblogic 8.1.4 SP4) .

 

I've tried setting the logging to the finest I can ( ConsoleLogger log =

new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG);  ) , but once 'Setting Up

Fonts' is displayed FOP breaks down

 

### Log message ###

 

[INFO] building formatting object tree

[WARNING] Screen logger not set - Using ConsoleLogger.

[INFO] setting up fonts

 

### END LOG ###

- At this point I have to kill the server by stopping the process.

(sounds like an endless loop to me)

 

I have got an in-memory XML dom4j document (the trax parser could not

parse my w3c document, because the value of a TextNode was null, and

threw a NullPointerException @ DOM2SAX.java:308 in xalan ver 2.7.0 !?!?)

and an xsl packaged in my .war file.

 

Has anyone encountered this problem when using the xalan

trax.xsltc.TransformerImpl????

 

 

However I found the TraxInputHandler, and figured that might help,

however, that only prints my static content. (As in all my xsl:value-of

.. statements are ignored completelxml source

and transforms it with an xslt source")

This is how I set it up..

InputSource xslSrc = new InputSource(xslStreamSource.getInputStream());

// from xsl:fo                                                  

                             InputSource xmlSrc = new InputSource(new

DocumentSource(xmlDoc).getInputSource().getByteStream()); // From dom4j

Document object

                             TraxInputHandler handler =  new

TraxInputHandler(xmlSrc, xslSrc);

                             handler.run(driver);

 

 

Am I doing it wrong??

Has anyone got an example of how to use the TraxInputhandler? (I can't

find any useful examples by googling it, probably the first time ever

that's happened)

 

Appreciate any help..

 

Regards

 

/Johan

 

 




Reply via email to