Re: [xsl] incrementing the index value

Subject: Re: [xsl] incrementing the index value
From: Arulraj <p_arulraj@xxxxxxxxx>
Date: Thu, 9 Jun 2005 06:44:07 -0700 (PDT)
Hello David,

Thank you.
I have used XSL in the following way it is working
fine.
<xsl:template match="Layout">
<taborder>
<fieldlist> 
<xsl:apply-templates
select="descendant-or-self::*/Box/textbox"/>
</fieldlist>
</taborder>	
</xsl:template>

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


Now, i want to collect position for somemore Fields
like "radio"


<?xml version="1.0" encoding="UTF-8"?>
<Layout>
	<Box>
		<textbox id="textbox">
			<value/>
		</textbox>
		<label name="LabelField1">
			<value>Label field1</value>
		</label>
		<textbox id="textbox1">
			<value/>
		</textbox>
		<label name="LabelField">
			<value>Label field</value>
		</label>
	</Box>
     <Box>
	<Box>
		<textbox id="TextBox2">
			<value/>
		</textbox>
		<textbox id="TextBox3">
			<value/>
		</textbox>
		<label name="LabelField3">
			<value>Rajan</value>
		</label>
		<label name="LabelField2" >
			<value>Arul</value>
		</label>
                <radio name="radio" id="radio">
                  <value/>
                </radio>
	</Box>
</Box>

</Layout>

I want to get the following output;
-----------------------------------------
<taborder>
    <fieldlist>
        <field tabindex="1" name="textbox"/>
        <field tabindex="2" name="textbox1"/>
        <field tabindex="3" name="texbox2"/>
        <field tabindex="4" name="textbox3"/>
        <field tabindex="5" name="radio"/>
    </fieldlist>
</taborder>

To get the above output i have specified;
<xsl:apply-templates
select="descendant-or-self::*/Box/radio"/>

I am getting following output;
-----------------------------------
<taborder>
    <fieldlist>
        <field tabindex="1" name="textbox"/>
        <field tabindex="2" name="textbox1"/>
        <field tabindex="3" name="texbox2"/>
        <field tabindex="4" name="textbox3"/>
        <field tabindex="1" name="radio"/>
    </fieldlist>
</taborder>

Any suggestion for this?

Thanks in advance
Regards,
Arul
--- David Carlisle <davidc@xxxxxxxxx> wrote:

>   But in my XML. I get <Box> within another <Box>
> and we
>   may get somemore parent <Box> element. 
> 
> 
> oh yes, well then perhaps you want
> 
>   select=".//textbox"
> 
> You haven't really said which elements you do want
> to process
> .//textbox will process all textbox elements in any
> descendent.
> 
>   So, I am looking for any Varaible assigning.
>   Please suggest me.
> 
> 
> You can't change the value of a variable once it is
> bound, so I don't
> see how using a variable here would help.
> 
> 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
>
________________________________________________________________________
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Current Thread