|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Get Position of Node in Ancestor Context
Answered my own question, but would still be interested in knowing what
others think of this solution...
<xsl:template match="input|select|textarea"> <xsl:copy> <xsl:for-each select="@*"> <xsl:copy /> </xsl:for-each> <xsl:variable name="currElemId" select="@id" /> <xsl:attribute name="tabindex"></xsl:attribute> <xsl:for-each select="ancestor::form//select|ancestor::form//input|ancestor::form// textarea"> <xsl:if test="not(@type = 'hidden') or @type = 'submit'"> <xsl:if test="@id = $currElemId"> <xsl:attribute name="tabindex"><xsl:value-of select="position()" /></xsl:attribute> </xsl:if> </xsl:if> </xsl:for-each> <xsl:apply-templates /> </xsl:copy> </xsl:template> The style sheet basically adds tabindex attributes to all form elements. What I'm unhappy with is the value of the select attribute of the second for-each element (the one that creates a node set of all child elements of a FORM element, regardless of what separates them). It seems odd that I have to fully qualify the child element I'm looking for, but using ancestor::form//select|input|textarea only matches the first element in the list. Also, what is the performance impact on setting up such for-each loops and is there a faster way to reproduce this node-set in the context of the current element (call-template with-param???)? Thanks! Ted Stresen-Reuter On Monday, March 10, 2003, at 09:21 AM, Ted Stresen-Reuter wrote: Hi, XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








