[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: collapsing number ranges

Subject: Re: collapsing number ranges
From: J-P S <jps@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 30 Aug 2004 10:53:20 +0100 (BST)
stylusstudio jp
On Mon, 30 Aug 2004, Jeni Tennison wrote:

) There are type-related implications: some people would say that since
) the values of $begin and $end are integers, you should process them as
) integers rather than pretending that they're strings.

You'd have to look to the schema for a declaration of their integral
nature, though, wouldn't you? So unless you're specifically typing (and
worrying about that later on) then they might as well be strings.

There's also the argument that idiv and mod are general functions which
don't depend on the base, whereas any string function assumes base 10.
Hence if you really wanted to then you could adapt these functions to
count pages in base 8, or base 13. Again, so long as your code is
watertight and won't need extending then that's probably moot.

(Incidentally, Bruce: I can't remember whether it was answered here, or
whether this was the level you wanted the answer pitched at, but "a mod b"
yields the remainder when a is divided by b, and "a idiv b"  gives you the
number of times b is divisible into a, not including the remainder. Thus

	a = (a idiv b) * b + (a mod b)

I think. The other numerical operators are more obvious and their usage is
explained in W3Schools' tutorials, although I can't immediately see idiv
as a function - is that new XPathery? Off the top of my Google there's a
brief tutorial at http://saxon.sourceforge.net/saxon7.9.1/expressions.html
that covers XPath 2.0)

Cheers,
J-P
-- 
Some pigs lead a revolt against people, act like jerks, and play poker.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.