Hi, all.
Within an xsl template, you can use the <xsl:attribut e> 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:f ield" mode="single">
<xsl:choose>
<xsl:when test="@type='ht mltextarea'">
<xsl:attribut e name="{../../onsubmit}">subm itEditForm()</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
--
Colin Fox
President
CF Consulting Inc.
Within an xsl template, you can use the <xsl:attribut e> 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:f ield" mode="single">
<xsl:choose>
<xsl:when test="@type='ht mltextarea'">
<xsl:attribut e name="{../../onsubmit}">subm itEditForm()</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
--
Colin Fox
President
CF Consulting Inc.
Comment