Re: Yelp Speedup

On Tue, 2005-12-13 at 22:01 -0700, Brent Smith wrote:
> Don Scorgie wrote:
> > Hi list,
> > 
> > I looked through the stylesheets from gnome-doc-utils and noticed it is
> > imported 4 times in different files:
> > 1: html/db2html.xsl
> > 2: common/db-label.xsl
> > 3: common/db-title.xsl
> > 4: common/db-xref.xsl
> > 
> > Removing the <xsl:import href="../../gettext/gettext.xsl"> commands from
> I guess the reason that this was not generating errors due to duplicate
> templates was because the xsl:import element was being used, which
> allows you to override template definitions.  Had xsl:include been used,
> this would immediately generated errors.
> I can't think of a good reason to import the gettext.xsl stylesheet from
> all three of the "common" stylesheets.  Either the parent stylesheet,
> db2html.xsl should include gettext.xsl, or a single xsl:import should be
> done from db-common.xsl, and db2html.xsl should include that.
> Shaun, is that right?

The reason those stylesheets included gettext was that
they required it.  More to the point, they called its
templates explicitly.  So the idea was that if someone
included db-title.xsl in their XSLT, it would bring in
everything it needed to work.

Then again, db-label.xsl explicitly calls templates in
db-number.xsl, and it doesn't include it.

The db-common.xsl module isn't really related to any
of the other three.  It's just a set of convenience
templates for miscellaneous crap you need to do with
DocBook.  Some of it isn't even DocBook-specific,
like the line-numbering code.

I think the only sensible way forward is to have XSLT
modules never import or include anything.  The only
XSLT files that do includes or imports would be the
top-level driver files, like db2html.xsl, and any of
the stylesheets under utils.

Then I should add to xsldoc a way to document that
an XSLT file depends on another, even though it isn't
explicitly imported.  People making custom stylesheets
using my stuff can look at the documentation and see
what they need to include to make each module work.

For right now, we just need to check if any of the
stylesheets under utils would be broken by removing
the imports from the common files.  Assuming they
work (or assuming they get fixed), we commit this
patch and throw a big "WE LOVE DON" party.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]