[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 #4 from Michael Kay <mike@saxonica.com> ---
Firstly, I think that attributes should be treated the same way whether created
by explicit instructions within the sequence constructor (e.g. xsl:attribute,
xsl:copy-of, xsl:apply-templates) or by LRE attributes or use-attribute-sets on
the containing instruction. I think this can be achieved by extending the scope
of "every preceding sibling instruction, text node, and literal result element
in the same sequence constructor" to include also any attributes on a
containing LRE and any [xsl:]use-attribute-sets instruction on the containing
element.

Now, should we treat elements with attributes as empty, or not? I think that
for common HTML use cases it makes sense to ignore attributes when assessing
emptiness: consider

<div>
  <where-populated>
    <ul><xsl:for-each select="order">...</xsl:for-each></ul>
  </where-populated>
  <xsl:on-empty>There were no orders this month</xsl:on-empty>
</div>

I don't think this should stop working if a class attribute is added to the
containing div, regardless of how it is added.

The point here is that *in HTML* attributes are conventionally used as metadata
and if there is no (real) content then the attributes can safely be forgotten.

Namespaces should definitely be ignored when considering emptiness.

My proposal in comment 1 achieves this.

One could argue that the status quo gives users a choice whether to treat
attributes as significant or not. But I think that making it depend on how the
attribute is created would lead to too many surprises. Another complication is
the rule about duplicate attributes, e.g.

<table class="x">
  <xsl:attribute name="class">y</xsl:attribute>

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

Received on Tuesday, 9 February 2016 20:29:44 UTC