Subject: RE: [xsl] collapsing number ranges From: J-P S <jps@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 27 Aug 2004 09:46:43 +0100 (BST) |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] collapsing number ranges, Bruce D'Arcus | Thread | Re: [xsl] collapsing number ranges, David Carlisle |
RE: [xsl] collapsing number ranges, Michael Kay | Date | RE: [xsl] collapsing number ranges, Jarno.Elovirta |
Month |