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

Re: While copying everything, append attribute value w

Subject: Re: While copying everything, append attribute value with incremental index.
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Sat, 11 Aug 2007 13:01:41 -0700
Re:  While copying everything
> However, can you explain the logic of the code that you provided:


I am afraid you will need to read about the <xsl:number .../>
instruction. Generally it is used to

    "allocate a sequential number to the current node"
    (from the XSLT 2.0 book of Dr. Kay).


-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play

On 8/11/07, Xuan Ngo <xuanngo2001@xxxxxxxxx> wrote:
> Thank you Dimitre Novatchev for your explanation of the position().
>
> However, can you explain the logic of the code that you provided:
>  <xsl:template match="A[@i]">
>   <xsl:variable name="vInum">
>     <xsl:number count="A[@i]"/>
>   </xsl:variable>
>   <A i="{concat(@i,'_',$vInum)}">
>          <xsl:apply-templates select=
>            "@*[not(name()='i')]
>            |
>             node()
>            "
>          />
>    </A>
>  </xsl:template>
> --------------------------
> I will take a shot here. Tell me if I am right. Each time that it encounters the condition
> "A[@i]", it will sum up all preceding "A[@i]". Hence, creating an incremental index(1,2,3,...).
> Then, it assigns the sum to the variable vInum so that later it can be used to create the element
> A. Since the code is creating the attribute i then it shouldn't copy it. Hence, the condition
> "[not(name()='i')]"
>
> thx!
>
>
>
> ____________________________________________________________________________________
> Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
> http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow

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.