You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by "Molitor, Stephen" <SM...@erac.com> on 2002/01/02 16:34:17 UTC

Using entities to control whitespace, TransformerException

I'm trying to using DTD entities, containing <xsl:text> elements, to control
whitespace.  However, I get an error when I try to use the entity in a
stylesheet.  If I replace the contents of the entity with it's literal
contents, it works.  Here's a simple .xsl file, where I declare a 'space'
entity, that demonstrates the problem:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE stylesheet [
<!ENTITY space "<xsl:text> </xsl:text>">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">
<xsl:output method="text"/>

<xsl:template match="/">
&space;
</xsl:template> 

</xsl:stylesheet>

When I run this, I get the following error:

file:///d:/javaweb/fleetservices/edgeweb/working/entity.xsl; Line 10; Column
8; XSLT Error (javax.xml.transform.TransformerConfigurationException):
javax.xml.transform.TransformerException:
javax.xml.transform.TransformerException: xsl:text is not allowed in this
position in the stylesheet!

I got the example out of a book, 'XSLT Quickly'.   (I removed some
extraneous stuff from the example).  I'm using the latest binary download of
Xalan-J, version 2.2.D14.  I'm using the version of Xerces that came with
the download.

Thanks!

Steve Molitor
smolitor@erac.com