RE: [xsl] Problem with base64encode.xsl

Subject: RE: [xsl] Problem with base64encode.xsl
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 18 Jul 2008 15:08:51 +0100
> Arithmetic operator is not defined for arguments of types (xs:string,
> xs:double)
> URL: http://www.w3.org/TR/xpath20/#ERRXPTY0004
> 
> The error points to this line in <xsl:call-template 
> name="binaryToDecimal">:
> 
> <xsl:with-param name="sum" select="$sum +
> substring($binary,string-length($binary) ) * $power"/>

You need to convert the result of substring() to a number. If it's a single
decimal digit you can do this with

xs:integer(substring($binary,string-length($binary))

Michael Kay
http://www.saxonica.com/
> 
> 
> 
> I call the template from here:
> 
> 
> 
> <xsl:for-each-group select="//settlement[ancestor::text[@xml:id]]"
> group-by="text()">
>  <xsl:variable name="ortAsBase64">
>   <xsl:call-template name="convertToBase64">
>    <xsl:with-param name="asciiString" 
> select="current-grouping-key()"/>
>   </xsl:call-template>
>  </xsl:variable>
> 
> [...]
> 
> <a href="http://dtm.bbaw.de/HSA/{$ortAsBase64}.html";>
> 
> [...]
> </xsl:for-each-group>
> 
> 
> Can you recognize where the fault may be or advice something else?
> 
> Thanks and best wishes, Torsten
> 
> - --
> Torsten Schassan
> Herzog August Bibliothek, Postfach 1364, D-38299 Wolfenbuettel
> Tel.: +49-5331-808-130, schassan {at} hab.de 
> http://www.hab.de; http://www.hab.de/forschung/projekte/weiss64.htm
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFIgJWlq4nZEP2KS4QRAoKnAJwO89Hr9se8xpCakCuMNfGJWebtagCcCCFU
> NEFnGY8X36mb1rDalRgRZCY=
> =Kpex
> -----END PGP SIGNATURE-----

Current Thread