saxon:documentation-prefixes may appear on the outermost element of the top-level
module in a package (
xsl:transform) to indicate that
particular namespaces declared in the stylesheet are used only for documentation purposes. This means that the namespace
binding cannot be used in names such as function names, template names, or variable names, and it does not form part of
the static context of expressions in the stylesheet, so it is not considered, for example, when casting a string to a QName.
One popular tool for documenting XSLT stylesheets is XSLTdoc,
which identifies comments using elements such as
xd:doc where the namespace is declared as
xmlns:xd="http://www.pnp-software.com/XSLTdoc". Ideally, adding this namespace to a stylesheet should have
no effect on its semantics. Most of the effects of adding a namespace can be eliminated by listing it in
however, there is still some residual effect, and in particular, the namespace forms part of the static context of XPath expressions,
and needs therefore to be included in SEF files so it is in scope at stylesheet execution time. Listing the namespace using
saxon:documentation-prefixes="xd" prevents this effect.
The attribute contains a whitespace-separated list of namespace prefixes, which must be declared. The (prefix, URI) pair represented by the prefix is added to a list of namespace bindings that are considered (throughout the package) to be purely documentary. This means that the binding cannot be used in the names of constructs such as variables and functions, and it does not form part of the in-scope namespaces property in the static context of expressions in the module. This means the namespace declaration will not appear in a SEF file containing the exported stylesheet.
A prefix that is listed in
saxon:documentation-prefixes should generally also be listed (explicitly or implicitly) in