Re: [xsl] Exception : Could not compile stylesheet

Subject: Re: [xsl] Exception : Could not compile stylesheet
From: "Charanpreet Arora" <send2charan@xxxxxxxxx>
Date: Mon, 31 Dec 2007 03:07:57 -0800
I'm sorry about missing the response at wrox forum.
Nevertheless, at the moment the only error message i can see on the console is

ERROR:  'org/apache/avalon/framework/configuration/Configuration'

which is thrown at the below line of Java code,

Templates templates = tFactory.newTemplates(new
StreamSource("ReceiptXSL-FO.xsl"));

which gives me the clue that there are some configuration related
issues while loading the stylesheet. My concern is that the
'org/apache/avalon/framework/configuration/Configuration' class
(bundled in avalon-framework-4.2.0.jar of FOP/lib dir) should not have
been invoked as currently I'm only transforming XML to XSL-FO using
Java-XML API's. I've not yet started with processing the output
(XSL-FO) into PDF with FOP. Moreover, I'm successfully able to do XML
-> XSL-FO -> PDF transformations  using Oxygen XML editor. Hence, I
doubt if my stylesheet has some errors. Most likely I'm not able to do
the manual configuration correctly before running the program as the
oxygen allows to configure everything (XSLT/FOP processor, extensions,
custom fonts) from one place. Please excuse me if my interpretation or
understanding is not correct.





On Dec 31, 2007 2:33 AM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> You asked this question before at
> http://p2p.wrox.com/topic.asp?TOPIC_ID=67920, and you seem to have ignored
> the response. The most important thing is to run your stylesheet in such a
> way that you can see the error messages; the exception which simply states
> that errors have been reported is useless on its own.
>
> Michael Kay
> http://www.saxonica.com/
>
>
> > -----Original Message-----
> > From: Charanpreet Arora [mailto:send2charan@xxxxxxxxx]
> > Sent: 31 December 2007 10:25
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: Re: [xsl] Exception : Could not compile stylesheet
> >
> > Please find below the styleheet for your reference:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> >     xmlns:fo="http://www.w3.org/1999/XSL/Format";
> >     version="1.0">
> >
> >     <xsl:output method="xml" version="1.0" indent="yes"/>
> >
> >     <xsl:include href="barcode.xsl"/>
> >     <xsl:include href="USReceiptTemplates.xsl"/>
> >
> >     <xsl:template match="/">
> >
> >         <fo:root font-size="8pt" color="black"
> > font-family="MyriadMed">
> >
> >             <fo:layout-master-set>
> >                 <fo:simple-page-master master-name="POSReceipt"
> > page-height="7.86in"
> >                     page-width="2.83in" margin-top="1cm"
> > margin-bottom="0.20cm" margin-left="0.20cm"
> >                     margin-right="0.20cm">
> >                     <fo:region-body margin-top="0.20cm"
> > margin-bottom="0.20cm"/>
> >                 </fo:simple-page-master>
> >             </fo:layout-master-set>
> >
> >             <fo:page-sequence master-reference="POSReceipt">
> >                 <fo:flow flow-name="xsl-region-body">
> >                     <fo:block>
> >                         <xsl:call-template name="adminReceiptHeader"/>
> >                         <xsl:call-template name="adminReceiptBody"/>
> >                         <xsl:call-template name="adminReceiptFooter"/>
> >                     </fo:block>
> >                 </fo:flow>
> >             </fo:page-sequence>
> >
> >         </fo:root>
> >     </xsl:template>
> >
> >     <xsl:template name="adminReceiptHeader">
> >         <xsl:if test="//header/text() != ''">
> >             <xsl:call-template name="receipt_header"/>
> >         </xsl:if>
> >         <xsl:call-template name="apple_logo"/>
> >         <xsl:call-template name="store_info"/>
> >         <xsl:call-template name="customer_info"/>
> >         <xsl:call-template name="rule">
> >             <xsl:with-param name="thickness">1pt</xsl:with-param>
> >         </xsl:call-template>
> >     </xsl:template>
> >
> >     <xsl:template name="adminReceiptBody">
> >         <fo:table>
> >             <fo:table-column column-width="75%" column-number="1"/>
> >             <fo:table-column column-width="25%" column-number="2"/>
> >             <fo:table-body>
> >                 <xsl:for-each select="//items">
> >                     <fo:table-row>
> >                         <xsl:call-template name="item_detail_line"/>
> >                     </fo:table-row>
> >                     <fo:table-row>
> >                         <fo:table-cell number-columns-spanned="2">
> >                             <xsl:copy-of select="$blank_line"/>
> >                         </fo:table-cell>
> >                     </fo:table-row>
> >                 </xsl:for-each>
> >             </fo:table-body>
> >         </fo:table>
> >         <xsl:call-template name="rule">
> >             <xsl:with-param name="thickness">1pt</xsl:with-param>
> >         </xsl:call-template>
> >         <xsl:call-template name="totals"/>
> >         <xsl:call-template name="rule">
> >             <xsl:with-param name="thickness">2pt</xsl:with-param>
> >         </xsl:call-template>
> >     </xsl:template>
> >
> >     <xsl:template name="adminReceiptFooter">
> >         <xsl:call-template name="barcode"/>
> >         <xsl:call-template name="loop">
> >             <xsl:with-param name="var" select="//footerBlankLines"/>
> >         </xsl:call-template>
> >         <xsl:for-each select="//footer">
> >             <fo:block text-align="center">
> >                 <xsl:value-of select="."/>
> >             </fo:block>
> >         </xsl:for-each>
> >     </xsl:template>
> >
> > </xsl:stylesheet>
> >
> >
> > On Dec 31, 2007 1:56 AM, Kamal Bhatt <kbhatt@xxxxxxxxx> wrote:
> > > Hi,
> > > I think you will get a better response from the Xalan mailing list.
> > > That said, I think that this is a problem with your
> > stylesheet. Do you
> > > have a copy of the stylesheet in question?
> > >
> > > Cheers.
> > >
> > >
> > > > Dear All,
> > > >
> > > > I'm using SimpleTransform.java (renamed as
> > ReceiptTransformer.java
> > > > for custom use) found in xalan-j_2_7_0 samples directory for
> > > > transformations in my custom application. The program compiles
> > > > successfully but gives the following error during runtime:
> > > >
> > > > ERROR:  'org/apache/avalon/framework/configuration/Configuration'
> > > > FATAL ERROR:  'Could not compile stylesheet'
> > > > Exception in thread "main"
> > > > javax.xml.transform.TransformerConfigurationException: Could not
> > > > compile stylesheet
> > > >
> > > > I'll really appreciate any help in
> > > > this regard.
> > > >
> > > > Thanks,
> > > > Charan.

Current Thread