[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|