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 John Black <Jo...@deltek.com> on 2002/01/09 14:14:54 UTC

Xalan's general entity processing in stylesheet

I am running an example from Bob DuCharme's book "XSLT Quickly" , page 237.
I have clipped and pasted the important lines below:
 
<!DOCTYPE stylesheet [
<!ENTITY space "<xsl:text> </xsl:text>">
]>
<xsl:stylesheet xmlns:xsl=" http://www.w3.org/1999/XSL/Transform
<http://www.w3.org/1999/XSL/Transform> "
     version="1.0">
 
<xsl:template match="employee">
  <xsl:apply-templates select="first"/>&space;
</xsl:template> 
 
</xsl:stylesheet>

An entity is declared at the top of the stylesheet named space.  It is a
simple text element whose content is a single space character.  It is used
later on, after the apply-templates element.  However, while processing this
with Xalan, I get the following error:
 
file:///C:/xml/xslt/tutorials/DuCharme/xq537a.xsl
<file:///C:/xml/xslt/tutorials/DuCharme/xq537a.xsl> ; Line 8; Column 48;
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 am using version 2.2 D14, invoked with the following command line:
 
C:\xml\xslt\tutorials\DuCharme>\bea\jdk131\bin\java -cp
\xml\xalan-j_2_2_D14\bin\xalan.jar;\xml\xalan-j_2_2_D14\bin\\xerces.jar;\xml
\xalan-j_2_2_D14\bin\xml-apis.jar org.apache.xalan.xslt.Process -in
xq528.xml -xsl xq537a.xsl -out xq538.txt  
 
Is this a problem with Xalan?  Xerces?  I believe the code is is correct and
should work.  In fact if you replace the entity reference with its contents,
the stylesheet does perform as intended.  The message is incorrect, xsl:text
_IS_ allowed in that position in the stylesheet!
 
Thanks,
 
John Black
Senior Software Architect
Deltek Systems, Inc.
8280 Greensboro Drive
McLean, VA 22102
703-734-8606 x4656
johnblack@deltek.com <ma...@deltek.com>