You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Albert Tsun <al...@excel.com.hk> on 2001/05/16 06:23:23 UTC
XSLT Transform Xalan question
Hi All,
I am using Xalan-j_2_0_0 which require to create a transformerFactory
TransformerFactory tFactory = TransformerFactory.newInstance();
and then which require to create a Transfomer by parsing my XSL.
Transformer transformer = tFactory.newTransformer(new
StreamSource(xslfile));
and then I call the Xalan XSLT by calling
transformer.transform(new StreamSource(xmlfile), new StreamResult(new
FileOutputStream(outfile)));
However, my xsl contains some Entity Reference which look like
<!DOCTYPE xsl:stylesheet [
<!ENTITY nl "<xsl:text>
</xsl:text>">
<!ENTITY nbsp "<xsl:text> </xsl:text>">
]>
and I use some template call
<xsl:call-template name="append-pad">
<xsl:with-param name="padChar"> </xsl:with-param>
<xsl:with-param name="padVar" select="$reportid"/>
<xsl:with-param name="length" select="14"/>
</xsl:call-template>
(See attached file: R2002.xsl)
When I call tFactory.newTransformer(new StreamSource(xslfile)), there is error :
file:c:/javaproject/xalan/input/R2002.xsl; Line 68; Column 50;
javax.xml.transform.TransformerConfig
urationException: xsl:text is not allowed in this position in the stylesheet!
at
org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.j
ava:650)
at XML2RptEngine.setReportXSLFile(XML2RptEngine.java:95)
at TestXalan.<init>(TestXalan.java:20)
at TestXalan.main(TestXalan.java:47)
Previously, I use Xalan-J_1_2_D02, since this do not require to parse XSL, it
works OK.
Would someone could help and give me some pointer ? Is this related to the
underlying parsing configuration i.e. Xerces ?
Many Thanks in advance.