Subject: [xsl] simple algebra on attributes.... From: <talosso@xxxxxxxxx> Date: Fri, 27 May 2005 10:54:01 +0200 |
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[@I=3D'mickey mouse']/V/@L"> <Point>=20 <xsl:choose> <xsl:when test=3D"../@L > 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Differences between AWTRe, JBryant | Thread | RE: [xsl] simple algebra on attribu, Andrew Welch |
RE: [xsl] XSL Positional Grouping P, Michael Kay | Date | RE: [xsl] How do I get a SUM of the, Michael Kay |
Month |