[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] sanely ordering template imports?


Subject: [xsl] sanely ordering template imports?
From: "James A. Robinson" <jim.robinson@xxxxxxxxxxxx>
Date: Tue, 6 Dec 2011 11:04:27 -0800

Folks,

I've got a set of stylesheets that I originally set up with a primary
stylesheet 'content.xsl' that imported four other stylesheets:

  content.xsl
    imports common.xsl
    imports clean-entry.xsl
    imports clean-xhtml.xsl
    imports clean-source.xsl

Originally

  content.xsl had the bulk of the logic for processing the input
  content

  common.xsl had a few xsl:variable definitions set (the values of
  which are independent of the input)

  clean-*.xsl contained simple xsl:template match rules that elided or
  lightly modified the content.

Basically content.xsl would pull the content from various sources and
then kick of processing a mode that would be picked up by one of the
three clean-*.xsl stylesheets.

After this original setup had been in place for a little while I found
myself needing to add new functionality to the clean-*.xsl stylesheets
that could benefit from importing common.xsl not because of the
stylesheet but because the editor I'm using (Oxygen) would complain
about missing definitions.  Basically both clean-*.xsl and content.xsl
would be referring to variables defined in common.xsl.

I can't be the first person who has encountered this, so I'm wondering
what you all do in situations like that.  Do you simply take the hit
of redundant import statements, or do you restructure your
stylesheets?  If you do the latter, do you tend to follow a specific
set of rules on how to lay out the imports?


Jim

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
James A. Robinson                       jim.robinson@xxxxxxxxxxxx
Stanford University HighWire Press      http://highwire.stanford.edu/
+1 650 7237294 (Work)                   +1 650 7259335 (Fax)


Current Thread