xsl-list
[Top] [All Lists]

simple algebra on attributes....

2005-05-27 01:54:01
Hi,

I'm a newbie at using XSL transformations.=20
I need to test the value of an attribute that represents an integer
(that comes out easily thanks to the > operator) and then I need to
change the value of that attribute performing a subtraction on its
value.

Is this kind of operations possibile with xsl?

In the following example the attribute is "L" in the "V" node.

<P I=3D"mickey mouse">
 <V>
   <m t=3D"2"></m>
 </V>
 <V L=3D"55443322">
   <m t=3D"2">Test 1</m>
 </V>
 <V L=3D"1000">
   <m t=3D"2">Test 2</m>
 </V>
 <V L=3D"11223344">
   <m t=3D"2">Test 3</m>
 </V>
</P>

And my transformation (that of course doesn't work) is:

 <xsl:template name=3D"Point_templ">
   <xsl:for-each select=3D"*/P[(_at_)I=3D'mickey mouse']/V/@L">
     <Point>=20
       <xsl:choose>
         <xsl:when test=3D"../@L &gt; 44332211">
           <xsl:attribute name=3D"lines">
             <xsl:number value=3D"../@L[value() - 44332211]"/>
           </xsl:attribute>=20
         </xsl:when> =20
         <xsl:otherwise>
           <xsl:attribute name=3D"lines">
             <xsl:number value=3D"../@L"/>
           </xsl:attribute>=20
         </xsl:otherwise>
       </xsl:choose>
    </Point>
   </xsl:for-each>                 =20
 </xsl:template>

Thanks for any help.
Regards.

Livio

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