[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: incrementing the index value

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

Thanks for the solution. 
But in my XML. I get <Box> within another <Box> and we
may get somemore parent <Box> element. 

In that case, if i use following way
<xsl:apply-templates select="Box/Box/textbox"/>
It wont give me proper output.

So, I am looking for any Varaible assigning.
Please suggest me.

thanks in advance

regards,
Arul

<?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>
	</Box>
</Box>

</Layout>

--- David Carlisle <davidc@xxxxxxxxx> wrote:

> 
> 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="{@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
>
________________________________________________________________________
> 
> 


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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.