[XSL-LIST Mailing List Archive Home]
RE: choose to define conditional attributes?
Subject: RE: choose to define conditional attributes?|
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Fri, 1 Oct 1999 10:22:02 +0100
> http://www.w3.org/TR/xslt#creating-attributes says, "Instantiating an
> xsl:attribute element adds an attribute node to the containing result
> element node". It's not terribly clear, but the "containing"
> node is the <xsl:attribute>'s parent, which is <xsl:when> in your
> example. You want the parent to be a result element, i.e. a literal result
> like <label> or an <xsl:element> instruction.
Oh! Is that a definitive interpretation? (a) "Containing" surely allows an
ancestor as well as a parent, (b) I thought it was talking about the result
tree not the stylesheet tree.
In SAXON I allow xsl:attribute to add an attribute to an element created
using an ancestor literal result element in the source stylesheet, or even
an element created using a different template (i.e. you can do an
xsl:call-template to a template that contains the xsl:attribute). The only
constraint is that the element in the result tree must be open and must not
have had any character content added to it. The supplied stylesheet fragment
struck me as entirely valid. The whitespace shouldn't be an issue either, it
is stripped from the stylesheet and is not added to the result tree.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list