C
Colin Fox
Hi, all.
Within an xsl template, you can use the <xsl:attribute> tag to set an
attribute of the current output node. This is great.
However, I need to be able to set an attribute of an ancestor node.
Here's the relevant part of my xsl:
<xsl:template match="myform:field" mode="single">
<xsl:choose>
<xsl:when test="@type='htmltextarea'">
<xsl:attribute name="{../../onsubmit}">submitEditForm()</xsl:attribute>
This doesn't work -- the parser rejects the "../../" syntax on the name.
Also, this particular technique (even if it worked) is fragile, because
what I really want to do is to set the 'onsubmit' attribute of the Form
parent element, which is at a potentially arbitrary level above the
current node.
So -- is there an XPath selector that I can use in the name field of the
attribute node to set the value of the Form parent, or do I have to do a
select at this point and select the parent? And if so, what would that
select look like? (I haven't done any backwards search selectors yet).
Thanks in advance,
cf
Within an xsl template, you can use the <xsl:attribute> tag to set an
attribute of the current output node. This is great.
However, I need to be able to set an attribute of an ancestor node.
Here's the relevant part of my xsl:
<xsl:template match="myform:field" mode="single">
<xsl:choose>
<xsl:when test="@type='htmltextarea'">
<xsl:attribute name="{../../onsubmit}">submitEditForm()</xsl:attribute>
This doesn't work -- the parser rejects the "../../" syntax on the name.
Also, this particular technique (even if it worked) is fragile, because
what I really want to do is to set the 'onsubmit' attribute of the Form
parent element, which is at a potentially arbitrary level above the
current node.
So -- is there an XPath selector that I can use in the name field of the
attribute node to set the value of the Form parent, or do I have to do a
select at this point and select the parent? And if so, what would that
select look like? (I haven't done any backwards search selectors yet).
Thanks in advance,
cf