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

adding numbers

Subject: adding numbers
From: 04083259@xxxxxxxxxxxxx
Date: Wed, 30 Mar 2005 13:36:43 +0100 (BST)
adding numbers
hi
i have the following xml database

<car>
<sub0><x>5</x><y>32</y><x>5</x><y>315</y></<x>54</x><y>31</y></sub0>
<sub1> <x>5</x><y>312</y></sub1>
<sub2><x>40</x><y> 48</y><x>120</x><y>-32</y><x>160</x><y>-6</y></sub2>
<sub3><x>0</x><y>8</y></sub3>
<sub4><x>10</x><y>-103</y><x>50</x><y>-83</y><x>90</x><y>-42</y></sub4>
<sub5><x>0</x><y>0</y><x>20</x><y>12</y><x>30</x><y>7</y></sub5>
 </car>

the following template will add the value of x and y  in last position
within the element sub2 to   x and y  in sub3

the problem i need to add  to x and y  within the element sub3 all the
priviouse x(s) and y(s) in last position  of the elements  sub2 and sub1
sub0 but could be more then these 3 elements

 <xsl:template match="path">
 <xsl:copy>
   <xsl:for-each select="*" >
 <xsl:choose>

<xsl:when test="contains(name(.), 'sub3') " >
<x><xsl:value-of
select="x[1]+current()/preceding-sibling::*[1]/child::x[position()=last()]"/></x><y><xsl:value-of
select="y[1]+current()/preceding-sibling::*[1]/child::y[position()=last()]"/></y>

    </xsl:when>

  </xsl:choose>
  </xsl:for-each>
  </xsl:copy>
 </xsl:template>

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.