xsl-list
[Top] [All Lists]

[xsl] key declarations in/for included stylesheets

2012-07-20 00:20:36
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:include?d.

I?m 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 don?t know if I can rely on that.

I?d 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 don?t know of such a construct in XSL.

What is the received wisdom for this sort of problem?

Thanks for any advice

Cheers
T



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>