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

Re: Condition problem

Subject: Re: Condition problem
From: "C. M. Sperberg-McQueen" <cmsmcq@xxxxxxxxxxxxxxxxx>
Date: Wed, 4 Nov 2009 11:08:40 -0700
Re:  Condition problem
On 4 Nov 2009, at 03:29 , Michael Kay wrote:
... First some comments:

<xsl:when test="matches(.,'-') or matches(.,'-')">

Why repeat the condition?

Actually, the two literals being tests are different characters (here, and elsewhere in the code where there appear at first glance to be duplicate tests): hyphen and en-dash.

It looks to me as if in cutting down the problem you omitted
some crucial control structures; I guess your full code contains
one or more for-each constructs to iterate.

Without the code in front of us it's hard to be sure, but from
the sample output you give, my guess is that when generating
the refid attribute your full code first looks for ranges
and supplies the items in the range, and then handles all of
the cr children that are not either the start or the end of
a range.  And (again, judging from your sample input and
output), you want the items mentioned in the refid attribute
to be listed in the order in which they appear (explicitly or
implicitly) in the cr elements in the document.

My first advice would be: replace the contents of

  <xsl:attribute name="refid">
   ...
  </xsl:attribute>

with a call to apply-templates, using a new mode:

<xsl:attribute name="refid">
<xsl:apply-templates mode="supply-refid-target-values" select="cr"/>
</xsl:attribute>


Then write three templates to handle the three kinds of cr
elements you have:

  (1) a cr element followed by a hyphen or an en-dash; it
      begins a range, so find the end of the range and emit
      the appropriate bibNN tokens, separated by blanks
  (2) a cr element preceded by a hyphen or an en-dash;
      it ends a range, so it has been handled by the
      first template, and should do nothing
  (3) any other cr element (followed by comma or nothing);
      it isn't a range, so just emit its bibNN token and
      a trailing blank

I hope this helps.

Michael Sperberg-McQueen


-- **************************************************************** * C. M. Sperberg-McQueen, Black Mesa Technologies LLC * http://www.blackmesatech.com * http://cmsmcq.com/mib * http://balisage.net ****************************************************************

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.