[xsl] Muenchian grouping on external XML files

Subject: [xsl] Muenchian grouping on external XML files
From: "Paul Spence" <paul.spence@xxxxxxxxx>
Date: Mon, 19 Jan 2004 18:31:53 -0000
Is there any way I can use keys when calling on external XML files using
the document function? I am trying to use the Muenchian grouping
technique to list unique content values for an element, but the values
exist in a document that is external to the one I'm processing.

More detail below (apologies for long post):

I am developing an application that publishes XML files (marked up in
TEI) as static HTML files. I am processing one set of XML files which
create the general web pages themselves, e.g. snippet from 'genweb.xml'

-----------------XML FILE--------------
     <p>This is an index of people:</p>
     <divGen id="personIndex" />
     <p>And some more text ...</p>

My TEI publishing process uses the <divGen> element in this XML file to
call for an index to be created at a particular point: in this case, an
index of people.

I have another series of (primary source) XML files that contains
various references to people. Snippet2 from an example 'primary.xml':

-----------------XML FILE--------------
     <p>Some text with mentions of <rs type="person">person 1</rs> and
<rs type="person">person 2</rs>.</p>
     <p>And some more text ...</p>
     <p>Another mention of <rs type="person">person 1</rs></p>

I group these primary source files together as a collection in
'master_primary.xml'. I then want to create an index of people mentioned
throughout the collection, with links to the individual mention.
Something like this:

-----------------HTML output--------------
Index of people mentioned

[each asterisk takes you to an individual mention of the person in

person 1:  *  *  *
person 2:  *  *  *  *  *

I normally do this with Muenchian grouping, but can't get it working on
external XML files. See following XSLT snippet, which I think crashes
because of the match pattern in <xsl:key>:

-----------------XSLT FILE--------------
<xsl:key name="myKeyName" match="document('master_primary.xml')//rs"
use="normalize-space(.)" />
<xsl:template match="divGen">
  <xsl:if test="@id='personIndex'">
                   NOW DO SOMETHING ELSE ...

I can think of other methods, using intermediate XML output, but would
prefer to avoid them if possible.

I am using Saxon processor version 6.5.2.

Thanks in advance,

Paul Spence
Centre for Computing in the Humanities
King's College London

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

Current Thread