Discretionary error handling in 'XSL Transformations (XSLT)'

Revised: 20000706

Each entry comprises five items:


signal-non-xslt-attribute-uri

2.1  XSLT Namespace

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[2]/div2[1]/p[4])

An element from the XSLT namespace may have any attribute not from the XSLT namespace, provided that the expanded-name of the attribute has a non-null namespace URI. The presence of such attributes must not change the behavior of XSLT elements and functions defined in this document. Thus, an XSLT processor is always free to ignore such attributes, and must ignore such attributes without giving an error if it does not recognize the namespace URI. Such attributes can provide, for example, unique identifiers, optimization hints, or documentation.

Is an error signaled when an element from the XSLT namespace has an attribute with an unrecognized namespace URI?


signal-non-xslt-top-level-element-uri

2.2  Stylesheet Element

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[2]/div2[2]/p[7])

In addition, the xsl:stylesheet element may contain any element not from the XSLT namespace, provided that the expanded-name of the element has a non-null namespace URI. The presence of such top-level elements must not change the behavior of XSLT elements and functions defined in this document; for example, it would not be permitted for such a top-level element to specify that xsl:apply-templates was to use different rules to resolve conflicts. Thus, an XSLT processor is always free to ignore such top-level elements, and must ignore a top-level element without giving an error if it does not recognize the namespace URI. Such elements can provide, for example,

Is an error signaled when a top-level element has an unrecognized namespace URI?


signal-unresolved-strip-preserve-conflict

3.4  Whitespace Stripping

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[3]/div2[4]/p[7])

It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.

Is an error signaled when there is an unresolved conflict between matches to xsl:strip-space and xsl:preserve-space elements?


signal-unresolved-template-rule-conflict

5.5  Conflict Resolution for Template Rules

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[5]/div2[5]/p[2])

It is an error if this leaves more than one matching template rule. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matching template rules that are left, the one that occurs last in the stylesheet.

Is an error signaled when there is an unresolved conflict between matches to xsl:template elements?


signal-multiple-alias-same-precedence

7.1.1  Literal Result Elements

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[7]/div2[1]/div3[1]/p[5])

A stylesheet can use the xsl:namespace-alias element to declare that one namespace URI is an alias for another namespace URI. When a literal namespace URI has been declared to be an alias for another namespace URI, then the namespace URI in the result tree will be the namespace URI that the literal namespace URI is an alias for, instead of the literal namespace URI itself. The xsl:namespace-alias element declares that the namespace URI bound to the prefix specified by the stylesheet-prefix attribute is an alias for the namespace URI bound to the prefix specified by the result-prefix attribute. Thus, the stylesheet-prefix attribute specifies the namespace URI that will appear in the stylesheet, and the result-prefix attribute specifies the corresponding namespace URI that will appear in the result tree. The default namespace (as declared by xmlns) may be specified by using #default instead of a prefix. If a namespace URI is declared to be an alias for multiple different namespace URIs, then the declaration with the highest import precedence is used. It is an error if there is more than one such declaration. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the declarations with the highest import precedence, the one that occurs last in the stylesheet.

Is an error signaled when a namespace URI is declared to be an alias for multiple different namespace URIs and the declarations have the same highest import precedence?


signal-element-name-not-qname

7.1.2  Creating Elements with xsl:element

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[7]/div2[1]/div3[2]/p[2])

The name attribute is interpreted as an attribute value template. It is an error if the string that results from instantiating the attribute value template is not a QName. An XSLT processor may signal the error; if it does not signal the error, then it must recover by making the the result of instantiating the xsl:element element be the sequence of nodes created by instantiating the content of the xsl:element element, excluding any initial attribute nodes. If the namespace attribute is not present then the QName is expanded into an expanded-name using the namespace declarations in effect for the xsl:element element, including any default namespace declaration.

Is an error signaled when the result of instantiating the name attribute of the xsl:element element is not a QName?


signal-attribute-name-not-qname

7.1.3  Creating Attributes with xsl:attribute

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[7]/div2[1]/div3[3]/p[2])

The name attribute is interpreted as an attribute value template. It is an error if the string that results from instantiating the attribute value template is not a QName or is the string xmlns. An XSLT processor may signal the error; if it does not signal the error, it must recover by not adding the attribute to the result tree. If the namespace attribute is not present, then the QName is expanded into an expanded-name using the namespace declarations in effect for the xsl:attribute element, not including any default namespace declaration.

Is an error signaled when the result of instantiating the name attribute of the xsl:attribute element is not a QName?


signal-add-attribute-after-children

7.1.3  Creating Attributes with xsl:attribute

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[7]/div2[1]/div3[3]/ulist[1]/item[1]/p[1])

Adding an attribute to an element after children have been added to it; implementations may either signal the error or ignore the attribute.

Is an error signaled when an attribute is added to an element after children have been added to it?


signal-add-attribute-non-element

7.1.3  Creating Attributes with xsl:attribute

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[7]/div2[1]/div3[3]/ulist[1]/item[2]/p[1])

Adding an attribute to a node that is not an element; implementations may either signal the error or ignore the attribute.

Is an error signaled when an attribute is added to a node that is not an element?


signal-attribute-non-text-content

7.1.3  Creating Attributes with xsl:attribute

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[7]/div2[1]/div3[3]/ulist[1]/item[3]/p[1])

Creating nodes other than text nodes during the instantiation of the content of the xsl:attribute element; implementations may either signal the error or ignore the offending nodes.

Is an error signaled when nodes other than text nodes are created when instantiating the content of the xsl:attribute element?


signal-two-attribute-set-same-attribute

7.1.4  Named Attribute Sets

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[7]/div2[1]/div3[4]/p[6])

Multiple definitions of an attribute set with the same expanded-name are merged. An attribute from a definition that has higher import precedence takes precedence over an attribute from a definition that has lower import precedence. It is an error if there are two attribute sets that have the same expanded-name and equal import precedence and that both contain the same attribute, unless there is a definition of the attribute set with higher import precedence that also contains the attribute. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing from amongst the definitions that specify the attribute that have the highest import precedence the one that was specified last in the stylesheet. Where the attributes in an attribute set were specified is relevant only in merging the attributes into the attribute set; it makes no difference when the attribute set is used.

Is an error signaled when two attribute sets that have the same expanded name and highest import precedence both contain


signal-pi-name-not-ncname-pitarget

7.3  Creating Processing Instructions

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[7]/div2[3]/p[4])

It is an error if the string that results from instantiating the name attribute is not both an NCName and a PITarget. An XSLT processor may signal the error; if it does not signal the error, it must recover by not adding the processing instruction to the result tree.

Is an error signaled when the result of instantiating the name attribute of the xsl:processing-instruction element is not an NCName and a PITarget?


signal-pi-non-text-content

7.3  Creating Processing Instructions

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[7]/div2[3]/p[5])

It is an error if instantiating the content of xsl:processing-instruction creates nodes other than text nodes. An XSLT processor may signal the error; if it does not signal the error, it must recover by ignoring the offending nodes together with their content.

Is an error signaled when nodes other than text nodes are created when instantiating the content of the xsl:processing-instruction element?


signal-pi-content-contains-delimiter

7.3  Creating Processing Instructions

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[7]/div2[3]/p[6])

It is an error if the result of instantiating the content of the xsl:processing-instruction contains the string ?>. An XSLT processor may signal the error; if it does not signal the error, it must recover by inserting a space after any occurrence of ? that is followed by a >.

Is an error signaled when the result of instantiating the content of the xsl:processing-instruction element contains the string ?>?


signal-comment-non-text-content

7.4  Creating Comments

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[7]/div2[4]/p[4])

It is an error if instantiating the content of xsl:comment creates nodes other than text nodes. An XSLT processor may signal the error; if it does not signal the error, it must recover by ignoring the offending nodes together with their content.

Is an error signaled when nodes other than text nodes are created when instantiating the content of the xsl:comment element?


signal-comment-content-contains-delimiter

7.4  Creating Comments

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[7]/div2[4]/p[5])

It is an error if the result of instantiating the content of the xsl:comment contains the string -- or ends with -. An XSLT processor may signal the error; if it does not signal the error, it must recover by inserting a space after any occurrence of - that is followed by another - or that ends the comment.

Is an error signaled when the result of instantiating the content of the xsl:processing-instruction element contains the string -- or ends with -?


signal-rtf-root-attribute-namespace-child

11.2  Values of Variables and Parameters

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[11]/div2[2]/ulist[1]/item[2]/p[2])

It is an error if a member of the sequence of nodes created by instantiating the template is an attribute node or a namespace node, since a root node cannot have an attribute node or a namespace node as a child. An XSLT processor may signal the error; if it does not signal the error, it must recover by not adding the attribute node or namespace node.

Is an error signaled when instantiating a variable-binding element adds an attribute node or namespace node as a child of the root of the result tree fragment?


signal-unretrievable-resource

12.1  Multiple Source Documents

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[12]/div2[1]/p[3])

When the first argument to the document function is not a node-set, the first argument is converted to a string as if by a call to the string function. This string is treated as a URI reference; the resource identified by the URI is retrieved. The data resulting from the retrieval action is parsed as an XML document and a tree is constructed in accordance with the data model (see ). If there is an error retrieving the resource, then the XSLT processor may signal an error; if it does not signal an error, it must recover by returning an empty node-set. One possible kind of retrieval error is that the XSLT processor does not support the URI scheme used by the URI. An XSLT processor is not required to support any particular URI schemes. The documentation for an XSLT processor should specify which URI schemes the XSLT processor supports.

Is an error signaled when there is an retreiving the resouce identified by a URI in an argument to the document function?


signal-unprocessable-fragment-identifier

12.1  Multiple Source Documents

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[12]/div2[1]/p[4])

If the URI reference does not contain a fragment identifier, then a node-set containing just the root node of the document is returned. If the URI reference does contain a fragment identifier, the function returns a node-set containing the nodes in the tree identified by the fragment identifier of the URI reference. The semantics of the fragment identifier is dependent on the media type of the result of retrieving the URI. If there is an error in processing the fragment identifier, the XSLT processor may signal the error; if it does not signal the error, it must recover by returning an empty node-set. Possible errors include:

Is an error signaled when there is an error processing the fragment identifier in a URI in an argument to the document function?


signal-two-output-same-attribute

16  Output

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[16]/p[8])

A stylesheet may contain multiple xsl:output elements and may include or import stylesheets that also contain xsl:output elements. All the xsl:output elements occurring in a stylesheet are merged into a single effective xsl:output element. For the cdata-section-elements attribute, the effective value is the union of the specified values. For other attributes, the effective value is the specified value with the highest import precedence. It is an error if there is more than one such value for an attribute. An XSLT processor may signal the error; if it does not signal the error, if should recover by using the value that occurs last in the stylesheet. The values of attributes are defaulted after the xsl:output elements have been merged; different output methods may have different default values for an attribute.

Is an error signaled when there is more than one instantiation of the same attribute on multiple xsl:output elements that have the highest import precedence?


signal-unsupported-encoding

16.1  XML Output Method

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[16]/div2[1]/p[5])

The encoding attribute specifies the preferred encoding to use for outputting the result tree. XSLT processors are required to respect values of UTF-8 and UTF-16. For other values, if the XSLT processor does not support the specified encoding it may signal an error; if it does not signal an error it should use UTF-8 or UTF-16 instead. The XSLT processor must not use an encoding whose name does not match the EncName production of the XML Recommendation . If no encoding attribute is specified, then the XSLT processor should use either UTF-8 or UTF-16. It is possible that the result tree will contain a character that cannot be represented in the encoding that the XSLT processor is using for output. In this case, if the character occurs in a context where XML recognizes character references (i.e. in the value of an attribute node or text node), then the character should be output as a character reference; otherwise (for example if the character occurs in the name of an element) the XSLT processor should signal an error.

Is an error signaled when the encoding attribute of the xsl:output element specifies an unsupported encoding?


signal-non-text-disabled-output-escaping

16.4  Disabling Output Escaping

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[16]/div2[4]/p[3])

It is an error for output escaping to be disabled for a text node that is used for something other than a text node in the result tree. Thus, it is an error to disable output escaping for an xsl:value-of or xsl:text element that is used to generate the string-value of a comment, processing instruction or attribute node; it is also an error to convert a result tree fragment to a number or a string if the result tree fragment contains a text node for which escaping was disabled. In both cases, an XSLT processor may signal the error; if it does not signal the error, it must recover by ignoring the disable-output-escaping attribute.

Is an error signaled when output escaping is disabled for a text node that is used for something other than a text node in the result tree?


signal-unsupported-disabled-output-escaping

16.4  Disabling Output Escaping

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[16]/div2[4]/p[5])

An XSLT processor will only be able to disable output escaping if it controls how the result tree is output. This may not always be the case. For example, the result tree may be used as the source tree for another XSLT transformation instead of being output. An XSLT processor is not required to support disabling output escaping. If an xsl:value-of or xsl:text specifies that output escaping should be disabled and the XSLT processor does not support this, the XSLT processor may signal an error; if it does not signal an error, it must recover by not disabling output escaping.

Is an error signaled when disabling output escaping of an xsl:value-of or xsl:text element is specified but disabling of output escaping is unsupported?


signal-unrepresented-character-disabled-output-escaping

16.4  Disabling Output Escaping

http://www.w3.org/TR/1999/REC-xslt-19991116.xml#xpointer(/spec[1]/body[1]/div1[16]/div2[4]/p[6])

If output escaping is disabled for a character that is not representable in the encoding that the XSLT processor is using for output, then the XSLT processor may signal an error; if it does not signal an error, it must recover by not disabling output escaping.

Is an error signaled when output escaping is disabled for a character that is not representable in the encoding used for output?