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

Re: number collapsing

Subject: Re: number collapsing
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Tue, 14 Dec 2004 09:12:20 -0500
Re:  number collapsing
On Dec 14, 2004, at 8:59 AM, Michael Kay wrote:

One observation:

       <xsl:when test="$begin castable as xs:integer">
         <xsl:variable name="begin2" select="$begin" as="xs:integer"/>

This may fail if $begin is a string. The string "123" is castable to xs:integer, but not assignable to xs:integer.

I'm not following here. Aren't I saying in the function "if $begin is an integer, then apply this logic to determine how to shorten $end; if not, then just print $end as is"?


Better to write the second
line as

<xsl:variable name="begin" select="xs:integer($begin)" as="xs:integer"/>

to force the cast.

The problem is that I don't know if the page numbers will be integers (consider "iii").


I think your new problem can be tackled using a "group-starting-with". The
only problem is that this requires nodes rather than atomic values. So we'll
start by putting the numbers into a temporary tree:


<xsl:function name="f:ranges" as="xs:string">
  <xsl:param name="pagelist" as="xs:integer*"/>

Note that my issue here was actually applying not to page numbers, but to the in-text citation markers. However, now that I think about it more, the same issue could apply to page number. Does this suggest that I ought to have a single generic number collapsing function that could be used for both citation markers and for page numbers?


Bruce

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.