Subject: Re: [xsl] Condition problem From: "C. M. Sperberg-McQueen" <cmsmcq@xxxxxxxxxxxxxxxxx> Date: Wed, 4 Nov 2009 11:08:40 -0700 |
... 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.
<xsl:attribute name="refid"> ... </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
-- **************************************************************** * C. M. Sperberg-McQueen, Black Mesa Technologies LLC * http://www.blackmesatech.com * http://cmsmcq.com/mib * http://balisage.net ****************************************************************
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Condition problem, Michael Kay | Thread | [xsl] How to concatenate/merge two , Ben Stover |
Re: [xsl] good Open source IDE Tool, C. M. Sperberg-McQue | Date | Re: [xsl] Benefits of using xsl:key, Jesper Tverskov |
Month |