[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: Fri, 27 Aug 2004 09:46:43 +0100 (BST)
orgone gun
On Fri, 27 Aug 2004, Michael Kay wrote:

) > 23-24 => 23-4
) > 333-334 => 333-34
) > 7777-7778 => 7777-78
) You just have to work through the second string outputting each digit
) only if the substring up to and including that digit differs from the
) leading substring of the same length in the other number - which can
) probably be done in 1.0 as easily as in 2.0.

Don't you need extensions to loop in such a way, to keep track of and
update the position of your cursor? Using saxon:assign and saxon:while :

  <xsl:variable name="digits" select="0" saxon:assignable="yes"/>

  <saxon:while test="substring($start,1,$digits) =
			substring($end,1,$digits)">
    <saxon:assign name="digits" select="$digits+1"/>
  </saxon:while>

  <xsl:value-of select="concat($start,'-',
			substring($end,$digits,string-length($end)))"/>

I can't see immediately how you'd do this with just xsl: elements.

Cheers,
J-P
-- 
The orgone gun is a distractor.  Eavis keeps rain off by being one of the
Elect.  You can identify the Elect because their heads are on upside-down.

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.