Re: Condition problem
... First some comments:
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:apply-templates mode="supply-refid-target-values" select="cr"/>
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.
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format