xsl-list
[Top] [All Lists]

Re: [xsl] Saxon Div Issue

2015-01-19 10:41:14
So Solution is to do :
 <xsl:variable name="num" select="xs:decimal(/xpath/num)"/>
?

On Mon, Jan 19, 2015 at 11:27 AM, G. Ken Holman 
g(_dot_)ken(_dot_)holman(_at_)gmail(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
Dak, in the response below you are misunderstanding our use of the
terminology.  We are talking about the representation of the number
internally in memory, we are not talking about whether the element or the
attribute is a number or not a number.  We are not talking about radix.  We
are talking about internal representation.

As Martin says, the numeric value of an element or an attribute is
represented in memory as a double-length binary value unless you tell it
differently.  If you are using XSLT 2.0 you can tell the processor to treat
it differently in memory by casting the element or attribute value into a
decimal representation internally.

Then, when you do arithmetic with decimal representations of values, the
result is a clean decimal result.  There is no loss of detail as when
happens when
using binary.

So, in your pseudo code below, you do know that it will be a double-length
binary value because you have not cast it to be anything else.  Radix has
nothing to do with this discussion.

I hope this helps.

. . . . . Ken

At 2015-01-19 16:06 +0000, Mailing Lists Mail daktapaal(_at_)gmail(_dot_)com 
wrote:

I wouldn't know if it will be a double that I will be a decimal.
Ignore the above inebriated statement.. All I meant was, I wouldnt
know if it will be a decimal.


On Mon, Jan 19, 2015 at 11:03 AM, Mailing Lists Mail
daktapaal(_at_)gmail(_dot_)com 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
THe problem is , I dont know what will come in the $num. It is an
xpath. It comes from an XML element.

SO sometimes, the element contains 988, and sometimes it contains 98.8
.. so my pseudo code actually is :"

$num = /xpath/num
var result = $num div 100

I wouldn't know if it will be a double that I will be a decimal.

Dak




--
Check our site for free XML, XSLT, XSL-FO and UBL developer resources |
Free 5-hour lecture:  http://www.CraneSoftwrights.com/links/video.htm |
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/s/ |
G. Ken Holman                    
mailto:gkholman(_at_)CraneSoftwrights(_dot_)com |
Google+ profile:       http://plus.google.com/+GKenHolman-Crane/about |
Legal business disclaimers:     http://www.CraneSoftwrights.com/legal |


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>