Subject: [xsl] crossreferencing any element From: James Cummings <James.Cummings@xxxxxxxxxxxxxx> Date: Mon, 24 Nov 2003 11:31:19 +0000 (GMT) |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Document Language, Wendell Piez | Thread | Re: [xsl] crossreferencing any elem, David Carlisle |
[xsl] Document Language, SHEIKH Sajjad | Date | [xsl] Applying templates, Barry van Weldam |
Month |