Search code examples
xmlxsltxslt-1.0dtdlibxslt

Applying entities in included XSLT documents causes error


I have an XSL stylesheet with entity definition in it:

<!DOCTYPE xsl:stylesheet SYSTEM "entities.dtd">

entities.dtd contains only one definition:

<!ENTITY copy "&#169;">

If I use &copy; in the document having the DOCTYPE declaration, everything works fine. But when I include another XSL document and try use the entity there, XSLT-processor says that 'copy' entity is not defined.

How can I define a global DTD to use it in any included XSL stylesheet?


Solution

  • Each module in your stylesheet is a freestanding XML document, and is submitted to the XML parser independently of other modules. It must therefore be well-formed it its own right, which means that it must define in its DTD any entities that it uses.