xsl-list
[Top] [All Lists]

Inconsistency between XPath 1.0 and XSLT 1.0 treatment of processing instruction initial whitespace

2004-07-20 06:13:46

I've encountered an apparent discrepancy between how the xsl:processing-instruction element behaves and the XPath 1.0 data model.

The XPath 1.0 data model specifically excludes leading white space from the string-value of a processing instruction node:

The string-value <http://www.w3.org/TR/xpath#dt-string-value> of a processing instruction node is the part of the processing instruction following the target and any whitespace.

However, "The content of the |xsl:processing-instruction| element is a template for the string-value of the processing instruction node." It is an error if this template contains non-text nodes. However, it is not an error if this template contains leading white space. For example, this case from the OASIS Microsoft XSLT comformance test suite is legal:

<xsl:template match="/">
BEFORE
  <xsl:processing-instruction name="testcase">
This is the content of a PI
  </xsl:processing-instruction>
AFTER
</xsl:template>
</xsl:stylesheet>

In other words, the xsl:processing-instruction element appears able to create processing instructions that are not legal in the XPath 1.0 data model.

Advice and comments would be appreciated. If I'm not missing something here, an erratum or clarification might be called for.

--
Elliotte Rusty Harold



<Prev in Thread] Current Thread [Next in Thread>