[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|