[xslt] key() behavior changed between 11 and 13?

The behavior of keys changed between somewhere between version 11 and

Because I'm dealing with a large (3 meg) XML document, I run a
preliminary script to generate a "map" of the original document, which
is essentially all the titles of various sections with some metadata,
in the same nested structure as the original document.

When I parse the original document, I create a key on <author>s and
then <section>s. Pretty standard stuff:

  <!-- for the authors and quoted-->
    match="//person" use="@id"/>

  <!-- for the sections-->
    match="//section" use="@id"/>

HOWEVER I then load in the "map" XML document using the "document()"
function and begin to step through /that/ instead of the original
document. With each <section> of the "map" document I do a key lookup
on the same <section> in the main document and apply some standard

  <xsl:apply-templates select="key('key_section', $frontpage)"

Where $frontpage is the value of an @id attribute inside a <section>
tag. This approach allows for a speedup of roughly 100x vs. traversing
the original document tree to pull out navigation information.

Anyway - this cross-document key-lookup worked in version 11, broke in
12, and continues to return 0 nodes per lookup in 13. Any suggestions?
Did something break, or is my approach wrong and shouldn't have worked
in the first place?

I hope I've been clear...I'm no programmer and a little lost here. I'd
be glad to elucidate as needed. In the meantime, I can stick with
version 11, which works outstandingly well for my purposes.

All of the code described above is in an archive at:

With a demo document included.

Thanks for all your work!

Paul Ford

paul ford // http://ftrain.com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]