One way to define the MCE semantics: XSLT

MURATA Makoto eb2m-mrt at
Thu Apr 12 15:16:16 CEST 2012

Dear colleagues,

I have been wondering how the semantics of MCE should be

Here is one way: a normative XSLT stylesheet.   I am not saying that this
is the best approach, but it at least deserves to be considered.

This XSLT stylesheet uses four extension functions:
me:frozen, me:ignored, me:selectable, and me:understood.

Let me:frozen be an XPath extension function such that
me:frozen(node) evalutes to true iff the node is an extension
extension element.

Let me:ignored be an XPath extension function such that
me:ignored(node) evalutes to true iff the node is an element or
attribute whose namespace is ignorable and non-understood.

let me:selectable be an XPath extension function such that
me:selectable(node) evalutes to true iff (1) this node is a Choice
element and each of the namespace specified by the Requires attribute
of this node is understood or (2) this node is a
Fallback element.

Let me:understood be an XPath extension function such that
me:understood(string) evaluates to true iff the string is a white-space
delimited list of understood namespaces.  Observe that me:undersood("")
is true.

Note: me:ignored, me:selectable, me:understood require the
configuration (i.e., a
set of understood namespaces) as an environment, while me:frozen does

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl=""

    <xsl:template match="*[me:frozen(.)]">
        <xsl:copy-of select="."/>

    <xsl:template match="*[me:ignored(.)]"/>
    <xsl:template match="@*[me:ignored(.)]"/>

    <xsl:template match="mce:AlternateContent">
        <xsl:for-each select="mce:Choice | mce:Fallback">
            <xsl:if test="me:selectable(.) and
                <xsl:apply-templates select="*"/>

    <xsl:template match="*">
            <xsl:when test="me:understood(namespace-uri(.))">
                <xsl:message terminate="yes">Non-understood namespace

    <xsl:template match="@mce:MustUnderstand[not(me:understood(string(.)))]">
        <xsl:message terminate="yes">Non-understood namespace
specified by @MustUnderstand</xsl:message>

    <xsl:template match="@*">
            <xsl:when test="me:understood(namespace-uri(.))">
                <xsl:message terminate="yes">Non-understood namespace

    <xsl:template match="text()|processing-instruction()|comment()">

P.S.  I am now  wondering what happens when an application-defined extension
element belongs to a non-understood and non-ignorable namespace.  Frozen
or discarded?

P.S.  I suppose that @MustUnderstood cannot be specified by
mce:Choice, or mce:Fallback.


Praying for the victims of the Japan Tohoku earthquake


More information about the sc34wg4 mailing list