xsl-list
[Top] [All Lists]

Re: Stumped on XPath

2006-02-13 14:03:10
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

On 2/9/06, Wendell Piez <wapiez(_at_)mulberrytech(_dot_)com> wrote:
Catching up again --

At 08:30 PM 2/7/2006, David wrote:

Thanks for the response. Your solution does in fact work perfectly.
The only problem is when I move the refnote element around (I used
1,2,3 for testing purposes however in truth these are more on the
lines of 2341234, 245532139, etc.) I don't get the results I expect.

just use the attribute on xsl:number to control whether it just numbers
in the current element, or the whole document, or from teh nearest
appendix ancestor or whatever you need.

I'm not sure quite what you want as I think you have a typo in your
revised version

No, it's a bit obscure ... both the references he's pointing to (1
and 3) are within the same appendix.

So he needs xsl:number from="appendix" just as you surmised.

Spenser, this is a far cleaner better solution than what you've
posted here so far.

Cheers,
Wendell


======================================================================
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>
--~--



--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>