On 22/08/2011 11:08, KAMOHELO MOFOKENG wrote:

I suspect the problem went away because of some other change you made and not because of this change.

Please do ensure that when your stylesheet contains a static error, you get to see the diagnostics showing what the error is. I would recommend you test your setup by injecting an error artificially and checking that the error message appears somewhere where you can see it. Otherwise you will be equally frustrated the next time you try to process some incorrect XSLT code.

Michael Kay
Saxonica

Hi Michael,
 
Thank you very much for the suggestion which led to a solution. I changed my code as follows:
 
<code>
Transformer xslfoTransformer;
 xslfoTransformer = getTransformer(transformSource);
...
 
private Transformer getTransformer(StreamSource streamSource)
{
// setup the xslt transformer
net.sf.saxon.TransformerFactoryImpl impl =
new net.sf.saxon.TransformerFactoryImpl();

try {
return impl.newTransformer(streamSource);

} catch (TransformerConfigurationException e) {
e.printStackTrace();
}
return null;
}
<code>
 
to
 
<code>

TransformerFactory factory = TransformerFactory.newInstance();

Transformer xslfoTransformer = factory.newTransformer(transformSource);

<code>
The difference: I used a TransformerFactory (instead of TransformerFactoryImpl) to obtain a Transformer object. 
 
I have no idea why it works but it does. Maybe someone can shed light on this issue for future reference.
 
Regards,
Kamo

--- On Fri, 8/19/11, Michael Kay <mike@saxonica.com> wrote:

From: Michael Kay <mike@saxonica.com>
Subject: Re: [saxon] TransformerConfigurationException
To: saxon-help@lists.sourceforge.net
Date: Friday, August 19, 2011, 7:57 PM

The exception is telling you that the compiler reported an error. By default the error will have been reported to System.err. If you're not seeing the error message, then the first thing you should do is organize your application so that compiler errors are logged somewhere. For example, you can do this by redirecting System.err to a file, or by writing your own ErrorListener.

Like others, I would have assumed that the error relates to the missing quotes, but since you've now told us that the stylesheet you posted isn't the same as the one that gave the error, I have no way of knowing what the actual error might be.

Michael Kay
Saxonica

On 19/08/2011 13:53, KAMOHELO MOFOKENG wrote:
Hi All,
 
Has anyone encountered this exception before, if yes, what does it mean?
 
I'm running a XSL-FO to PDF code inside a JApplet. The code work fine as a stand alone module but it fails inside an applet throwing the exeption:
 
--------------------------------------------------------------------------------------------------------------------------------
javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected.
 at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:124)
 at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:125)
 at net.sf.saxon.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:80)
_________________________________________________________________________

XML File:
----------------------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1"?>
<root>
<name>shyam</name>
<friend>
 <name>Abc</name>
 <phNo>90909090909</phNo>
</friend>
<friend>
 <name>Xyz</name>
 <phNo>32323232323</phNo>
</friend>
</root>
______________________________________________________________________
 
XSL File:
----------------------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.1"
 xmlns:xsl=http://www.w3.org/1999/XSL/Transform
  xmlns:fo="http://www.w3.org/1999/XSL/Format"
 exclude-result-prefixes="fo">
<xsl:template match="root">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="my-page">
      <fo:region-body margin="1in"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="my-page">
    <fo:flow flow-name="xsl-region-body">
      <fo:block>Hello, <xsl:value-of select="name" />!</fo:block>
      <fo:block>
       <fo:table>
         <fo:table-body>
          <fo:table-row>
                 <fo:table-cell border="solid 1px black"
   text-align="center" font-weight="bold">
                  <fo:block>
                      No.
                    </fo:block>
                 </fo:table-cell>
                 <fo:table-cell border="solid 1px black"
   text-align="center" font-weight="bold">
                  <fo:block>
                      Name
                    </fo:block>
                 </fo:table-cell>
                 <fo:table-cell border="solid 1px black"
   text-align="center" font-weight="bold">
                  <fo:block>
                      Phone Number
                    </fo:block>
                 </fo:table-cell>
                </fo:table-row>
                <xsl:for-each select="./friend">
                 <fo:table-row>
                 <fo:table-cell border="solid 1px black" text-align="center">
                  <fo:block>
                      <xsl:value-of select="position()" />
                    </fo:block>
                 </fo:table-cell>
                 <fo:table-cell border="solid 1px black" text-align="center">
                  <fo:block>
                      <xsl:value-of select="name" />
                    </fo:block>
                 </fo:table-cell>
                 <fo:table-cell border="solid 1px black" text-align="center">
                  <fo:block>
                      <xsl:value-of select="phNo" />
                    </fo:block>
                 </fo:table-cell>
                </fo:table-row>
                </xsl:for-each>
         </fo:table-body>
       </fo:table>
      </fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
______________________________________________________________________
 
Does anyone know why?
 
Thanks in advance
Kamo
------------------------------------------------------------------------------ Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help


-----Inline Attachment Follows-----

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2

-----Inline Attachment Follows-----

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help
------------------------------------------------------------------------------ uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help