Hi Spenser,
If you posted your original XSLT which David fixed, that would help,
but I think I remember it well enough -- David's suggestion should
work cleanly as long as you say
<xsl:number from="appendix"/>
instead of the <xsl:number/> he guessed at.
The principle he elucidated, namely that you traverse to the
referenced node and do the operation there, still applies.
<xsl:number/> (in some configuration) spares you all the work of
counting things using explicit XPath. The only tricky part is getting
the xsl:number set up to give what you want. In this case, unless you
say you want to count the appendix elements, it uses the default,
which is counting the refnote elements themselves, in their local
context (i.e. each one inside its parent). This gives you "1" (i.e.
"A") for refnotes 1, 2, and 4, which are each the first refnotes in
their parents. (refnote 3 will get you "B"). By switching this to
count the appendixes you should get "A" for refnote 1, "B" for
refnotes 2 and 3, and "C" for 4.
Cheers,
Wendell
At 04:03 PM 2/13/2006, you wrote:
Hi Wendell and David,
Sorry I was out of town on a course. I do agree that the solution that
David suggested is cleaner, however it only works with the original
xml. Sorry if the second example was obscure, perhaps this demostrates
it better:
XML
<?xml version="1.0"?>
<doc>
<manual>
<sentence>This is a sentence with a reference<id ref="1"/> as an
inline element</sentence>
<clause>This is a clause with inline elements <strong>
and</strong> a reference <id ref="4"/></clause>
</manual>
<appendix>
<refnote id="1">This is the first reference</refnote>
</appendix>
<appendix>
<refnote id="2">This is the second reference</refnote>
<refnote id="3">This is the third reference</refnote>
</appendix>
<appendix>
<refnote id="4">This is the third reference</refnote>
</appendix>
</doc>
Should produce:
<html><head><META http-equiv="Content-Type" content="text/html"></head><body>
<p>This is a sentence with a reference (see Appendix A) as an
inline element</p>
<p class="clause">This is a clause with inline elements <strong>
and</strong> a reference (see Appendix C) </p>
</body></html>
But instead produces:
<html><head><META http-equiv="Content-Type" content="text/html"></head><body>
<p>This is a sentence with a reference (see Appendix A) as an
inline element</p>
<p class="clause">This is a clause with inline elements <strong>
and</strong> a reference (see Appendix A) </p>
</body></html>
I'm sure it's something small I'm missing on my end. I do agree that
this would be a much better solution, so any thoughts would be
appreciated
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--