[xsl] Why aren't ENTITY declarations in a main stylesheet visible in the included stylesheets?

Subject: [xsl] Why aren't ENTITY declarations in a main stylesheet visible in the included stylesheets?
From: "Roger L Costello costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 2 Jun 2022 10:51:31 -0000
Hi Folks,

I have a "main" stylesheet that declares a bunch of entities:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY sidPROC "'2'">
<!ENTITY starPROC "'1'">
...
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:xs="http://www.w3.org/2001/XMLSchema";
    exclude-result-prefixes="xs"
    version="3.0">

The main stylesheet xs:includes some supporting stylesheets:

    <xsl:include href="MAP-sid.xsl"/>
    <xsl:include href="MAP-star.xsl"/>

Those supporting stylesheets use the entities, e.g.,

<xsl:assert test="$TRM_PAR_row/PROC eq &sidPROC;" />

When I run SAXON on my main stylesheet I get this error:

SXXP0003  Error reported by XML parser: The entity "sidPROC" was referenced,
but not declared.

I thought that an xs:include is essentially a "macro substitution", in which
case the entity declaration should be visible, yes?

I don't want to have ENTITY declarations scattered around multiple files.
What's the best way to deal with ENTITIES?

/Roger

Current Thread