Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: datatype datatypeTo: NULL Date: 7/2/2009 2:15:00 PM Hi. I need to perform some subtraction on some variables. At first my XSLT 2.0 code looked like this: <xsl:variable name="bboxTokens" select="tokenize(@bbox,',')"/ > <xsl:variable name="bboxWidth" select="$bboxTokens[3] - $bboxTokens[1]"/> <xsl:variable name="bboxHeight" select="$bboxTokens[4] - $bboxTokens[2]"/> And the error was that the datatype didn't support the operator - (minus). So I added the as= attribute to declare the datatype: <xsl:variable name="bboxTokens" as="decimal" select="tokenize (@bbox,',')"/> <xsl:variable name="bboxWidth" as="decimal" select="$bboxTokens [3] - $bboxTokens[1]"/> <xsl:variable name="bboxHeight" as="decimal" select="$bboxTokens[4] - $bboxTokens[2]"/> This time the complaint was an unknown datatype. So I put this: xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" in the declaration and this in the main code: <xsl:variable name="bboxTokens" as="xdt:decimal" select="tokenize(@bbox,',')"/> <xsl:variable name="bboxWidth" as="xdt:decimal" select="$bboxTokens[3] - $bboxTokens[1]"/> <xsl:variable name="bboxHeight" as="xdt:decimal" select="$bboxTokens[4] - $bboxTokens[2]"/> Still an unknown datatype. What am I doing wrong? I'm using Altova 2009 XSLT 2.0 Engine (command line). TIA--- | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
