xsl-list
[Top] [All Lists]

[xsl] position and loop problem

2008-08-14 00:12:15
Hello
I save the number of a specific node as follow and get
the right number for the node which is 2:
       <xsl:variable name="var"
select="count(document/elements/element[(_at_)type='section'])"/>
However when I try it in a for-each loop as follow I
get  6 times looping!
Hier is the for-each loop:

<xsl:for-each select="//*[position() &lt;= $var]">
<p> text</p>
</xsl:for-each>
Hier is the output:

Text
Text
Text
Text
Text
Text

The other problem which I think connects together with
the problem above is, in a loop I cant use the
following array (node position) :

<xsl:for-each select="//*[position() &lt;= $var]">

<xsl:value-of disable-output-escaping="yes"
select="document/elements/element[(_at_)type='heading1'][$pos]"/>
?????.
</xsl:for-each>

Without the loop the array works and specific node can
be accessed!

Hier is the XML:
*******************
<document>
        <elements>

            <element id="headin1"
description="xml.xlbl.heading1" type="inputfield"
size="50"   default="true"/>
                <element id="heading2" description="K.xlb.headin2" 
type="inputfield" size="70" default="true" />    
                <element id="section" description="section" 
type="inputfield" size="50" default="true" />   
                <element id="section" description="section" 
type="inputfield" size="50" default="true" />
    
                
        </elements>     
        
</document>
*********************
Thanks for your help















__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen 
Massenmails. 
http://mail.yahoo.com 

--~------------------------------------------------------------------
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>
--~--