[Bug 29434] [XSLT30] xsl:on-empty/on-non-empty with attributes and use-attribute-sets

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29434

--- Comment #2 from Abel Braaksma <abel.braaksma@xs4all.nl> ---
That is a change, I'm not sure we intended emptiness to mean a sequence of
attributes. Since this instruction may be used in contexts where we are not
constructing an element, I'm not sure that is desirable (though I can see
benefits and downsides).

More importantly, I realize that we may not be defining this clearly enough in
terms of "Constructing complex/simple content". I think it makes sense that
xsl:on-empty kicks in *after* constructing the content leaves us with
emptiness. If we do, the next ambiguity, about a document node with empty text
node children becomes a no-brainer, as they are normalized away.

As such, I propose something along those lines instead:

When a sequence constructor contains an xsl:on-empty instruction, it is first
removed (as if by use-when="false()") and the resulting sequence constructor is
evaluated following the rules in [#REF: 5.7 Sequence Constructor]. If the
result is a zero-length text node (or a sequence of zero-length strings, but
the rules in 5.7 prevent that from happening), the sequence constructor result
is discarded and replaced by the result of evaluating the sequence constructor
or select attribute of the xsl:on-empty instruction.

-----
That, of course, does not answer the question whether attribute nodes created
by the sequence constructor should be considered.

Example: a sequence ctor that adds lat/long as attributes

<xsl:template match="coor[lat|long]">
   <xsl:attribute name="lat" select="lat" />
   <xsl:attribute name="long" select="long" />
   <xsl:on-empty>
      <xsl:attribute name="lat" select="'#absent'" />
      <xsl:attribute name="long" select="'#absent'" />
   </xsl:on-empty>
</xsl:template>

If we change xsl:on-empty the way you suggest, the above would never trigger
the xsl:on-empty. Is that really how we want it to behave? Shouldn't that be in
the realm of xsl:where-populated?

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 9 February 2016 19:21:15 UTC