Hi everyone,
I am having a problem with entities needed in included .xsl files. I need
to include several entity files and several xsl files from one main xsl
file. In the included xsl files, I want to be able to use the already
included entities, but I cannot get it to work.
The only way I can get this to work, is if I also include the .ent file in
the includedfile.xsl, but defining the same entities in the main xsl file
and also the "include"ed xsl file seems wrong. If there a way to just
include the entities once so they become usable to all included xsl files?
I am running sablotron 0.9 and expat 1.95.4. I first thought this was a
Sablotron issue, but after consulting the sablotron list, this does not
seem to be the case.
Example and files below.
--------------------
# sabcmd test.xsl test.xml
Error [code:2] [URI:file:includedfile.xsl] [line:5]
XML parser error 11: undefined entity
---------------------
--- test.xml --------------
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<document>
<page/>
</document>
---------------------------
--- test.xsl --------------
<!DOCTYPE xsl:stylesheet [
<!ENTITY % myents1 SYSTEM "entities.ent"> %myents1;
]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href='includedfile.xsl'/>
<xsl:template match="page">
test.xsl: Where is my entity? &myentity;
</xsl:template>
</xsl:stylesheet>
---------------------------
--- includedfile.xsl ------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" encoding="iso-8859-1" />
<xsl:template match="document">
includedfile.xsl: start<br/>
includedfile.xsl: where is my entity? &myentity;<br/>
<xsl:apply-templates select="//page"/>
includedfile.xsl: end<br/>
</xsl:template>
</xsl:stylesheet>
---------------------------
--- entities.ent ----------
<!ENTITY myentity "Here I am!">
---------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list