- From: Michael Kay <mhk@mhk.me.uk>
- Date: Fri, 6 Feb 2004 11:18:02 -0000
- To: <public-qt-comments@w3.org>
This proposal updates a previous internal proposal: http://lists.w3.org/Archives/Member/w3c-xsl-wg/2003Oct/0000.html which got timed-out in the WG deliberations on more substantial matters. It attempts to revise the way in which particular dynamic errors are classified, to give a more consistent treatment. I have reviewed and revised the originally proposed classifications. The main aim of this proposal is to get rid of the interoperability problems that arise because some processors treat a construct as an error and others take the recovery action. Many of the errors previously classified as recoverable errors are now classified as warning conditions: for these conditions, the processor may (but is not required to) output a warning, but must continue processing. So all processors will produce the same result tree, though some may give warnings along the way. Some other errors (those where no user would ever invoke the recovery behavior deliberately) are changed to non-recoverable errors, and a few are changed to non-errors, with the previous recovery action becoming the norm. There is a new (small) category of "system errors", which are conditions that are outside the direct control of the stylesheet author or the XSLT processor. The main characteristic of these errors is that the effect is to some extent implementation-dependent. Each error code is followed by a note describing the proposed change if any, and then a copy of the existing error text. Michael Kay ERR XT0030 No change It is a non-recoverable dynamic error if the effective value of an attribute written using curly brackets, in a position where an attribute value template is permitted, is a value that is not one of the permitted values for that attribute. ERR XT0040 No change It is a non-recoverable dynamic error if the invocation of the stylesheet specifies a template name that does not match the expanded-QName of a named template defined in the stylesheet. ERR XT0050 No change It is a non-recoverable dynamic error if the stylesheet that is invoked declares a visible stylesheet parameter with required="yes" and no value for this parameter is supplied during the invocation of the stylesheet. A stylesheet parameter is visible if it is not masked by another global variable or parameter with the same name and higher import precedence. ERR XT0060 No change It is a non-recoverable dynamic error if the initial template defines a template parameter that specifies required="yes". ERR XT0070 No change When the focus is undefined, evaluation of any expression that references the context item, context position, or context size results in a non-recoverable dynamic error. ERR XT0160 No change If an implementation does not support backwards-compatible behavior, then it is a non-recoverable dynamic error if any element is evaluated that enables backwards-compatible behavior. ERR XT0270 Proposal: make this a non-recoverable error if the declarations are different, and not an error if they are the same. (Minor backwards incompatibility). It is a recoverable dynamic error if this [the process of finding an xsl:strip-space or xsl:preserve-space declaration to match an element in the source document] leaves more than one match. Action: The optional recovery action is to select, from the matches that are left, the one that occurs last in declaration order. ERR XT0290 No change Where the result of evaluating an XPath expression (or an attribute value template) is required to be a lexical QName, then unless otherwise specified it is a non-recoverable dynamic error if the defining element has no namespace node whose name matches the prefix of the lexical QName. This error may be signaled as a static error if the value of the expression can be determined statically. ERR XT0310 No change The transformation fails with a non-recoverable dynamic error if any XPath expression is evaluated and raises a dynamic error. ERR XT0330 No change It is a non-recoverable dynamic error for an expression to call any function that is not included in the in-scope functions. ERR XT0380 Proposal: make this a non-recoverable error. A recoverable dynamic error occurs if the sequence [being used to construct the content of an element or document node] contains an atomic value of type xs:QName, because such values cannot be cast to a string. Action: The optional recovery action is to ignore the offending xs:QName value. ERR XT0410 Proposal: make this a warning condition It is a recoverable dynamic error if the result sequence used to construct the content of an element node contains a namespace node or attribute node that is preceded in the sequence by a node that is neither a namespace node nor an attribute node. Action: The optional recovery action is to ignore the offending namespace or attribute node. ERR XT0420 Proposal: make this a warning condition It is a recoverable dynamic error if the result sequence used to construct the content of a document node contains a namespace node or attribute node. Action: The optional recovery action is to ignore the offending namespace or attribute node. ERR XT0430 Proposal: make this a warning condition It is a recoverable dynamic error if the result sequence contains two or more namespace nodes having the same name but different string values (that is, namespace nodes that map the same prefix to different namespace URIs). Action: The optional recovery action is to discard all conflicting namespace nodes other than the one that appears last in the result sequence. ERR XT0440 No change It is a recoverable dynamic error if the result sequence contains a namespace node with no name and the element node being constructed has a null namespace URI (that is, it is an error to define a default namespace when the element is in no namespace). Action: The optional recovery action is to ignore the offending namespace node. ERR XT0450 Proposal: make this a non-recoverable error. A recoverable dynamic error occurs if the sequence [being used to construct the content of an attribute, namespace, comment, or processing-instruction node] contains a value of type xs:QName, because such values cannot be cast to a string. Action: The optional recovery action is to ignore the xs:QNamevalue. ERR XT0490 Proposal: make this a "system" error It is a recoverable dynamic error if such a source document [an input document, a document returned by the document, doc FO or collection FO functions, a document returned by an extension function or extension instruction, or a document supplied as a stylesheet parameter] does not already satisfy the constraints listed above [in summary, that the namespace nodes on the tree are consistent with those produced by parsing a well-formed document conforming to the XML Namespaces Recommendation] . Action: This is a recoverable error. The optional recovery action is either to perform namespace fixup, or to produce implementation-dependent results. ERR XT0510 Proposal: make this a type error (so it can be reported statically if detected statically) It is a recoverable dynamic error if an xsl:apply-templates instruction with no select attribute is evaluated when the context item is not a node. Action: The optional recovery action is to return the empty sequence. ERR XT0540 Proposal: make this a warning condition It is a recoverable dynamic error if the conflict resolution algorithm for template rules leaves more than one matching template rule. Action: The optional recovery action is to select, from the matching template rules that are left, the one that occurs last in declaration order. ERR XT0560 Proposal: no change It is a non-recoverable dynamic error if xsl:apply-imports or xsl:next-match is evaluated when the current template rule is null. ERR XT0610 Proposal: no change If an optional parameter has no select attribute and has an empty sequence constructor, and if there is an as attribute, then the default value of the parameter is an empty sequence. If the empty sequence is not a valid instance of the required type defined in the as attribute, then the parameter is treated as a required parameter, which means that it is a non-recoverable dynamic error if the caller supplies no value for the parameter. ERR XT0640 No change In general, a circularity in a stylesheet is a non-recoverable dynamic error. ERR XT0700 No change In other cases, [with xsl:apply-templates, xsl:apply-imports, and xsl:next-match, or xsl:call-template with tunnel parameters] it is a non-recoverable dynamic error if the template that is invoked declares a template parameter with required="yes" and no value for this parameter is supplied by the calling instruction. ERR XT0730 Proposal: make this not an error. It's an enormous burden on implementations to detect this error, and it's likely that most implementations don't do it; the recovery action is quite adequate. It is a recoverable dynamic error if the expansion of two or more different xsl:attribute-set declarations with the same name and the same import precedence produce attribute nodes having the same name. Action: The optional recovery action is to include both attribute nodes in the result. When the resulting set of attribute nodes is added to an element node, only the last of the duplicates will take effect. ERR XT0800 No change Within the body of a stylesheet function, the focus is initially undefined; this means that any attempt to reference the context item, context position, or context size is a non-recoverable dynamic error. ERR XT0820 Proposal: make this a non-recoverable error. This is backwards incompatible, but it is very unlikely that any stylesheets have been deliberately written to rely on the recovery behavior. It is a recoverable dynamic error if the effective value of the name attribute [of the xsl:element instruction] is not a lexical QName. Action: The optional recovery action is to return the sequence of nodes created by evaluating the sequence constructor, excluding any initial attribute and namespace nodes. ERR XT0830 Proposal: make this a warning condition In the case of an xsl:element instruction with no namespace attribute, it is a recoverable dynamic error if the effective value of the name attribute is a QName whose prefix is not declared in an in-scope namespace declaration for the xsl:element instruction. Action: The optional recovery action is to ignore the prefix part of the lexical QName, with the effect that the new element will be in the default namespace. ERR XT0850 Proposal: make this non-recoverable (as XT0820) It is a recoverable dynamic error if the effective value of the name attribute [of an xsl:attribute instruction] is not a lexical QName or is the string xmlns. Action: The optional recovery action is to return the empty sequence. ERR XT0860 Proposal: make this a warning condition In the case of an xsl:attribute instruction with no namespace attribute, it is a recoverable dynamic error if the effective value of the name attribute is a lexical QName whose prefix is not declared in an in-scope namespace declaration for the xsl:attribute instruction. Action: The optional recovery action is to ignore the prefix part of the QName. ERR XT0890 Proposal: make this non-recoverable (as XT0820) It is a recoverable dynamic error if the effective value of the name attribute [of the xsl:processing-instruction instruction] is not both an NCName Names and a PITarget XML. Action: The optional recovery action is to return the empty sequence. ERR XT0900 Proposal: make this a warning condition It is a recoverable dynamic error if the result of evaluating the content of the xsl:processing-instruction contains the string ?>. Action: The optional recovery action is to insert a space after any occurrence of ? that is followed by a > ERR XT0920 Proposal: make this non-recoverable (as XT0820) It is a recoverable dynamic error if the effective value of the name attribute [of the xsl:namespace instruction] is neither a zero-length string nor an NCName Names, or if it is xml or xmlns. Action: The optional recovery action is to return the empty sequence. ERR XT0930 Proposal: make this non-recoverable It is a recoverable dynamic error if evaluating the select attribute or the contained sequence constructor of an xsl:namespace instruction results in a zero-length string. Action: The optional recovery action is to return the empty sequence. ERR XT0950 Proposal: make this a warning condition It is a recoverable dynamic error if the result of evaluating the content of the xsl:comment contains the string -- or ends with -. Action: The optional recovery action is to insert a space after any occurrence of - that is followed by another - or that ends the comment. ERR XT0980 Proposal: make this a warning condition It is a recoverable dynamic error if any undiscarded item in the atomized sequence [supplied as the value of the value attribute of xsl:number ] cannot be converted to an integer, or if the resulting integer is less than 1 (one). Action: The optional recovery action is to convert that item (after atomization, but before conversion to a number) to a string as if by a call to the string FO function and then to insert the resulting string into the formatted result string in its proper position. If the value cannot be converted to a string, the error is treated as an unrecoverable error. ERR XT0990 Proposal: make this a type error It is a recoverable dynamic error if the xsl:number instruction is evaluated, with no value or select attribute, when the context item is not a node. Action: The optional recovery action is to return the empty sequence. ERR XT1030 Proposal: make this a warning condition It is a recoverable dynamic error if, for any sort key component, the set of sort key values evaluated for all the items in the initial sequence, after any type conversion requested, contains a pair of ordinary values for which the result of the XPath lt operator is an error. Action: The optional recovery action is to assign an arbitrary but consistent implementation-dependent ordering to any such pair of values. ERR XT1035 Proposal: make this a warning condition It is a recoverable dynamic error if the collation URI specified to xsl:sort is a collation that is not recognized by the implementation. Action: The optional recovery action is to sort using the collation that would be chosen if the collation attribute were omitted. ERR XT1140 No change It is a non-recoverable dynamic error if the effective value of the regex attribute [of the xsl:analyze-string instruction] does not conform to the required syntax for regular expressions, as specified in [Functions and Operators]. Action: The processor must signal the error. If the regular expression is known statically (for example, if the attribute does not contain any expressions enclosed in curly brackets) then the processor may signal the error as a static error. ERR XT1145 No change It is a non-recoverable dynamic error if the effective value of the flags attribute [of the xsl:analyze-string instruction] has a value other than the values defined in [Functions and Operators]. Action: The processor must signal the error. If the value of the attribute is known statically (for example, if the attribute does not contain any expressions enclosed in curly brackets) then the processor may signal the error as a static error. ERR XT1150 No change It is a non-recoverable dynamic error if the effective value of the regex attribute [of the xsl:analyze-string instruction] is a regular expression that matches a zero-length string: or more specifically, if the regular expression $r and flags $f are such that matches("", $r, $f) returns true. Action: The processor must signal the error. If the regular expression is known statically (for example, if the attribute does not contain any expressions enclosed in curly brackets) then the processor may signal the error as a static error. ERR XT1160 Proposal: change to System Error When a URI reference [supplied to the document function] contains a fragment identifier, it is a recoverable dynamic error if the media type is not one that is recognized by the processor, or if the fragment identifier does not conform to the rules for fragment identifiers for that media type, or if the fragment identifier selects something other than a sequence of nodes (for example, if it selects a range of characters within a text node). Action: The optional recovery action is to ignore the fragment identifier and return the document node. ERR XT1170 Proposal: change to System Error It is a recoverable dynamic error if a URI [supplied in the first argument to the unparsed-text function] cannot be used to retrieve a resource containing text. Action: The optional recovery action is to treat the URI as if it referenced a resource containing a zero-length string. ERR XT1180 Proposal: change to Warning It is a recoverable dynamic error if a resource [retrieved using the unparsed-text function] contains characters that are not permitted XML characters. Action: The optional recovery action is to replace each invalid character with the character #xFFFD (Unicode Replacement Character). ERR XT1190 No change It is a non-recoverable dynamic error if a resource [retrieved using the unparsed-text function] contains octets that cannot be decoded into permitted XML characters using the specified encoding. This includes the case where the processor does not support the requested encoding. ERR XT1200 No change It is a non-recoverable dynamic error if the second argument of the unparsed-text function is omitted and the processor cannot infer the encoding using external information and the encoding is not UTF-8. ERR XT1260 No change It is a non-recoverable dynamic error if the value [of the first argument to the key function] is not a valid QName, or if there is no namespace declaration in scope for the prefix of the QName, or if the name obtained by expanding the QName is not the same as the expanded name of any xsl:key declaration in the stylesheet. Action: The processor must signal these errors. If the processor is able to detect the error statically (for example, when the argument is supplied as a string literal), then the processor may optionally signal this as a static error. ERR XT1270 No change It is a non-recoverable dynamic error to call the key function if there is no context node, or if the root of the tree containing the context node is not a document node. ERR XT1280 Proposal: change to non-recoverable error. It is highly improbable that existing stylesheets deliberately rely on this behavior. It is a recoverable dynamic error if the name specified as the $decimal-format-name argument [ to the format-number function] is not a valid QName, or if its prefix has not been declared in an in-scope namespace declaration, or if the stylesheet does not contain a declaration of a decimal-format with a matching expanded-QName . If the processor is able to detect the error statically (for example, when the argument is supplied as a string literal), then the processor may optionally signal this as a static error. Action: The optional recovery action is to ignore the $decimal-format-name argument. ERR XT1310 Proposal: change to warning The picture string [supplied to the format-number function] must conform to the following rules [see full specification] . It is a recoverable dynamic error if the picture string does not satisfy these rules. Action: The optional recovery action is to ignore those characters in the supplied picture string that make the picture string invalid. If a valid picture string cannot be constructed in this way, the processor may recover by returning the string obtained by applying the string FO function to the supplied number. ERR XT1320 Proposal: change to warning It is a recoverable dynamic error if [while processing the format-number function] the absolute value of the adjusted number is numerically greater than or equal to the overflow-threshold. Action: The optional recovery action is to format the number as if each zero-digit-sign character in the integer part of the sub-picture were a digit-sign. ERR XT1350 Proposal: change to warning It is a recoverable dynamic error if a component specifier within the picture [used for date/time formatting] refers to components that are not available in the given $value. Action: The optional recovery action is to ignore the offending component specifiers. ERR XT1360 No change If the current function is evaluated within an expression that is evaluated when the context item is undefined, a non-recoverable dynamic error occurs. ERR XT1370 No change It is a non-recoverable dynamic error if the unparsed-entity-uri is called when there is no context node, or when the root of the tree containing the context node is not a document node. ERR XT1380 No change It is a non-recoverable dynamic error if the unparsed-entity-public-id is called when there is no context node, or when the root of the tree containing the context node is not a document node. ERR XT1390 No change It is a non-recoverable dynamic error if the value [supplied as the $property-name argument to the system-property function] is not a valid QName, or if there is no namespace declaration in scope for the prefix of the QName. Action: The processor must signal these errors. If the processor is able to detect the error statically (for example, when the argument is supplied as a string literal), then the processor may optionally signal this as a static error. ERR XT1400 Change to warning condition It is a recoverable dynamic error if the argument [passed to the function-available function] does not evaluate to a string that is a valid QName, or if there is no namespace declaration in scope for the prefix of the QName. Action: The optional recovery action is to return the value false. If the processor is able to detect the error statically (for example, when the argument is supplied as a string literal), then the processor may optionally signal this as a static error. ERR XT1410 Under a separate proposal, this error is being changed (under some circumstances) to a static error It is a non-recoverable dynamic error if a FunctionCall XP within an XPath expression is evaluated, when the function in question is not available. ERR XT1420 No change It is a non-recoverable dynamic error if the arguments supplied to a call on an extension function do not satisfy the rules defined for that particular extension function, or if the extension function reports an error, or if the result of the extension function cannot be converted to an XPath value. ERR XT1440 Change to warning condition It is a recoverable dynamic error if the argument [passed to the element-available function] does not evaluate to a string that is a valid QName, or if there is no namespace declaration in scope for the prefix of the QName. Action: The optional recovery action is to return the value false. If the processor is able to detect the error statically (for example, when the argument is supplied as a string literal), then the processor may optionally signal this as a static error. ERR XT1450 No change When a processor performs fallback for an instruction element, if the instruction element has one or more xsl:fallback children, then the content of each of the xsl:fallback children must be evaluated; it is a non-recoverable dynamic error if it has no xsl:fallback children. ERR XT1480 No change It is a non-recoverable dynamic error to evaluate the xsl:result-document instruction in temporary output state. ERR XT1490 No change It is a non-recoverable dynamic error for a transformation to generate two or more result trees with the same URI. ERR XT1500 Change to "system error" It is a recoverable dynamic error for a stylesheet to write to an external resource and read from the same resource during a single transformation, whether or not the same URI is used to access the resource in both cases. Action: The optional recovery action is implementation-dependent: implementations are not obliged to detect the error condition. ERR XT1610 Change to warning condition It is a recoverable dynamic error for output escaping to be disabled for an xsl:value-of or xsl:text instruction that is used to generate 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. Action: The optional recovery action is to ignore disable-output-escaping attribute. ERR XT1620 Change to warning condition It is a recoverable dynamic error if an xsl:value-of or xsl:text instruction specifies that output escaping is to be disabled and the implementation does not support this. Action: The optional recovery action is to ignore the disable-output-escaping attribute. ERR XT1630 Change to warning condition It is a recoverable dynamic error if an xsl:value-of or xsl:text instruction specifies that output escaping is to be disabled when when writing to a result tree that is not being serialized. Action: The optional recovery action is to ignore the disable-output-escaping attribute. ERR XT1640 Change to warning condition It is a recoverable dynamic error if output escaping is disabled for a character that is not representable in the encoding that the processor is using for output. Action: The optional recovery action is to ignore the disable-output-escaping attribute. ERR XT1665 No change A basic XSLT processor must raise a non-recoverable dynamic error if the input to the processor includes a node with a type annotation other than xdt:untypedAny or xdt:untypedAtomic, or an atomic value of a type other than those which a basic XSLT processor supports. ERR XT1670 No change A processor that does not claim conformance with the backwards compatibility feature must raise a non-recoverable dynamic error if an instruction is evaluated containing an [xsl:]version attribute that invokes backwards compatible behavior.
Received on Friday, 6 February 2004 06:17:38 UTC