[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: key declarations in/for included stylesheets

Subject: Re: key declarations in/for included stylesheets
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Fri, 20 Jul 2012 08:51:32 +0100
Re:  key declarations in/for included stylesheets
On 20 July 2012 06:20, Trevor Nicholls <trevor@xxxxxxxxxxxxxxxxxx> wrote:
> 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:

It's a common problem, typically with variables or functions defined
elsewhere and imported/included by some ancestor stylesheet so given
just the file you are looking at there's not much to go on.  I think
there are some new features coming in 3.0 that will help here.

My personal preference is to not break up a file for the sake of it.
It's ok to have large XSLT files - if there is a natural grouping to
what you are doing then break them up along those lines, but dont
force it.  I see projects where there are hundreds of small
stylesheets, and entry point stylesheets that are just hundreds of
includes...

In this particular case with keys, if its for reuse elsewhere then you
will need to keep the keep definitions in each of the files they are
used.  If the common parent imports them then its key definition will
be used.  If it includes them then the key definitions will be merged
(you can have multiple definitions of a key with the same name) which
I think will ultimately have the same result as they would be
identical.


--
Andrew Welch
http://andrewjwelch.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.