Mike Kay
> Is it possible to utilise a given namespace for
> (effectively) comments, i.e. the named namespace is not
> treated as a literal and output.
>
> Rationale:
>
> E.g. constructing an
> outline of the stylesheet operation,
> explanatory documentation,
> providing multi-modal representations, etc.
>
> The stylesheet application then simply bypasses anything
> in that namespace, treating it as a comment.
>
>
> This would support conformance to the XML accessibility guidelines.
There is a neat trick you can use for this: just declare your
namespace as
an extension namespace.
<xsl:stylesheet
xmlns:x="my.accessibility.namespace"
extension-element-prefixes="x">
<x:comment>....</x:comment>
The XSLT processor is required to ignore extension instructions in a
namespace that it does not recognize. David C finishes this off with
Oh. I use this trick a lot but I always throw in an empty
xsl:fallback element as well I thought this was needed and
was surprised by your comment
The XSLT processor is required to ignore extension
instructions in a
namespace that it does not recognize.
the XSLT 1.0 spec seems a bit obscure here. 14.1 says
An XSLT processor must not signal an error merely because a
template contains an extension element for which no
implementation is available.
However the preceding sentence is When such an extension element is instantiated, then the XSLT
processor must perform fallback for the element as
specified in [15
Fallback].
and fallback says:
if the instruction element has one or more xsl:fallback
children, then
the content of each of the xsl:fallback children must be
instantiated
in sequence; otherwise, an error must be signaled.
I have always read this as saying if there are no
xsl;fallback elements then the "otherwise" clause implies
that an error will be signaled.
(Mike later replied, You're right. There must be an <xsl:fallback/>. I was
thinking of
top-level elements. |