xsl-list
[Top] [All Lists]

Re: incrementing the index value

2005-06-09 06:00:19

If you wantto use position() then you need to make sure that you only
select the nodes you want

If you do this:

        <xsl:for-each select="child::*">
                <xsl:choose>
                        <xsl:when test="self::textbox">

then all element children will be selected (and get a position,
accordingly, but you only use textbox children so there will be gaps in
your ordering.

If instead you do

<xsl:for-each select="textbox">
                <xsl:call-template name="getintoBox"/>
then only testbox children will be selected 

using xsl:for-each and call-template makes things unnecessarily
complicated, it would be more natural to templaes using match= rather
than name= and then use

<xsl:apply-templates select="textbox"/>

I think in this case you want

<xsl:template match="Layout">
<taborder>
<fieldlist>
 <xsl:apply-templates select="Box/textbox"/>
</fieldlist>    
</taborder>     
</xsl:template>

<xsl:template match="textbox">
 <field name="{(_at_)id}" tabindex="{position()}"/>
</xsl:template>



I want to use the variable and incretment the count. 

Your code (and my modification of it) don't use variables so I didn't
understand this comment.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>