#739 xsl:message and attribute nodes

v9.0
closed
Michael Kay
5
2012-10-08
2007-11-23
Michael Kay
No

What should do? The specification doesn't really say. Saxon 8.9 and previous releases output a sequence of name-value pairs, for example

a="foo" b="bar"

Saxon 9.0 throws an error "XTDE0420: Cannot create an attribute node (attribute) whose parent is a document node"

On the whole, the Saxon 8.9 action seems friendlier, though what 9.0 is doing is very logical according to the specification.

This only ever worked in the first place by accident, as it was exploiting the fact that TreeReceiver wasn't checking its arguments carefully enough.

I'm putting a patch in Subversion that stops this throwing an error. It will now output the attributes in the form of processing instructions:

It will also do this if you try (in xsl:message) to output attributes or namespaces anywhere where there isn't an element start tag to attach them to.

I've raised a bug on the spec to try to get a clarified definition of what ought to happen, so the solution may change again in the future.

Discussion

  • Michael Kay
    Michael Kay
    2007-12-01

    Logged In: YES
    user_id=251681
    Originator: YES

    Fixed in 9.0.0.2