xsl-list
[Top] [All Lists]

Re: incrementing the index value

2005-06-09 06:44:07
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="{(_at_)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(_at_)nag(_dot_)co(_dot_)uk> 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

________________________________________________________________________


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




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
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>
--~--



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