Subject: key declarations in/for included stylesheets
From: Trevor Nicholls <trevor@xxxxxxxxxxxxxxxxxx>
Date: Fri, 20 Jul 2012 17:20:20 +1200
|
I have started with an unwieldy stylesheet which I am breaking up into
smaller stylesheets to facilitate reuse.
The original stylesheet includes the declaration
<!-- key for cross references -->
<xsl:key name="id" match="*[@id]" use="@id" />
and this key is used in three places. I want to take these and move them
into separate stylesheets which will be xsl:included.
Im not sure what the best practice is here:
I could put a note in the included stylesheets saying that the parent
stylesheet must contain the key declaration.
Or I could put a unique key declaration into each included stylesheet and
use that:
<xsl:key name="blah-id" match="*[@id]" use="@id" />
Maybe a smart processor would recognise that this was identical to the other
keys and not replicate it? I dont know if I can rely on that.
Id like to do something like
#ifndef idkey
<!-- key for cross references if not already declared -->
<xsl:key name="id" match="*[@id]" use="@id" />
#define idkey
#end
but I dont know of such a construct in XSL.
What is the received wisdom for this sort of problem?
Thanks for any advice
Cheers
T
|