This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: adding variables
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 12 Mar 2002 21:41:32 -0000
- Subject: RE: [xsl] adding variables
- Reply-to: xsl-list at lists dot mulberrytech dot com
> I want to have an offset stored so that I can move
> around all off my components based on this offset. I
> have created a variable:
>
> <xsl:variable name="y_offset">
> <xsl:value-of select="20"/>
> </xsl:variable>
Much better to write <xsl:variable name="y_offset" select="20"/>. That way
your variable is a number, not a result tree fragment that can be converted
to a number when required.
>
> and want to add to the offset. Something to the effect
> of:
>
> <path d="M 35, {$y_offset} + 25 ....
Close. <path d="M 35, {$y_offset + 25} ..."> should do the trick. The stuff
inside the {} is an XPath expression, the stuff outside is just text.
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list