Subject: RE: [xsl] stylesheet expansion From: "Scott Trenda" <Scott.Trenda@xxxxxxxx> Date: Mon, 10 Dec 2007 14:10:53 -0600 |
Since the original question involved the reduction of dependency on paths and required a single stylesheet with the import precedences converted to priorities, I'd say my reply here is slightly off-topic, but I'd like to chime in while Abel has brought up the subject. I use a type of single-file stylesheet collection system, nearly identical to what Abel defines below, in a personal project of mine. My intentions are slightly different, simply to reduce common aspects of the small perfunctory stylesheets to a single instance. Instead of Xpointer, though, I use a PHP function that performs a transformation on the collection-file which: - adds the xsl version attribute (limited to 1.0 via libxslt right now) - copies any namespace nodes from parent elements - adds an xsl:import of a common.xsl file of frequently-used templates. It does save plenty of space and clutter (especially routine declarations like xmlns:xsl), and ensures I can rely on the common templates being present in the collection's stylesheets. The transformation that picks out the requested stylesheet is fairly simple; it just takes in an "id" parameter and looks for the first child of the root node that has the same ID. (I'm using a few literal-result element stylesheets, so it's not limited to xsl:stylesheet children.) If anyone's interested, I could post the stylesheet and the particular collection I'm using, but we should split off the topic at that point. ~_^ ~ Scott -----Original Message----- From: Abel Braaksma [mailto:abel.online@xxxxxxxxx] Sent: Monday, December 10, 2007 12:59 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] stylesheet expansion Andrew Welch wrote: > As Colin has said, compiled stylesheets seem to be the only way, but > may be not what the OP was after. Ideally importable compiled > "stylesheet modules" will be invented soon.... :) It really shouldn't be too hard to make a structure something like the following, which is basically a simple collection framework for stylesheets and can internally be gathered into a set of compiled stylesheets: <col:stylesheet-collection xmlns:col="http://stylesheet-collection" start-with="main"> <xsl:stylesheet col:name="main".... > <xsl:import href="#import-me" /> </ <xsl:stylesheet col:name="import-me"> <xsl:output ... /> <xsl:template match="... </ </col:stylesheet> Or something like that. What catalogs are to XML and DTD, can stylesheet collections be for XSLT. Perhaps a new standard ;) Cheers, -- Abel Braaksma
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] stylesheet expansion, Abel Braaksma | Thread | Re: [xsl] stylesheet expansion, Colin Adams |
Re: [xsl] stylesheet expansion, Abel Braaksma | Date | Re: [xsl] stylesheet expansion, Colin Adams |
Month |