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

crossreferencing any element

Subject: crossreferencing any element
From: James Cummings <James.Cummings@xxxxxxxxxxxxxx>
Date: Mon, 24 Nov 2003 11:31:19 +0000 (GMT)
crossreferencing
Hiya,  using either xslt1 or xslt2, I want to match *any* element
that has a @corresp attribute, and for each whitespace separated
idref contained within, produce a link to this id.  I don't know
what elements will have @id or @corresp, and they will all also
have templates doing other things to them. I think xslt2 tokenize()
is an easy way to get at the idrefs, and copying any instance of
@id is fairly straightforward.  But I get warnings of ambiguous
matches each time I try to match an element (for example para) and
also have a general match for it to create the cross referencing
links.

Let's say I have an input of something structurally akin to:
--------
<document>
<para id="a1" corresp="a2 a4"> This is a test</para>
<para id="a2" corresp="a1"> This paragraph refers to a1</para>
<para id="a3"> This paragraph does not refer to a1</para>
<para id="a4" corresp="a1 q54"> This paragraph refers to a1 and
q54</para>
<para id="a5" corresp="a6"> This paragraph refers to a6</para>
<para id="a6" corresp="a1 a5"> This paragraph refers to a1 and a5</para>
<para id="a7">
This is a longer paragraph that has a
<ab id="q54" corresp="a4">span</ab> that
refers back to a4.
</para>
</document>
--------

And want a fairly straightforward transformation into:
--------
<html>
<body>
<p id="a1"> <a href="#a2">[xref]</a> <a href="#a4">[xref]</a>This is a
test</p>
<p id="a2"> <a href="#a1">[xref]</a> This paragraph refers to a1</p>
<p id="a3"> This paragraph does not refer to a1</p>
<p id="a4"> <a href="#a1">[xref]</a> <a href="#q54">[xref]</a> This
paragraph refers to a1 and q54</p>
<p id="a5"> <a href="#a6">[xref]</a> This paragraph refers to a6</p>
<p id="a6"> <a href="#a1">[xref]</a> <a href="#a5">[xref]</a> This
paragraph refers to a1 and a5</p>
<p id="a7">
This is a longer paragraph that has a
<span class="ab" id="q54"><a href="#a4">[xref]</a>span</span> that
refers back to a4.
</p>
</body>
</html>
--------

Suggestions?

-James

---
Dr James Cummings, Oxford Text Archive, James.Cummings@xxxxxxxxxxxxxx

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.