I'm trying to get what I've been working on into shape to distribute
more widely, and am wondering if my approach to modularizing the (xslt
2.0) code makes sense.
I have a main file that looks like:
<!-- read the external citation style file -->
<xsl:param name="citation-style" required="yes" as="xs:string" />
<xsl:variable name="styles" as="document-node()"
select="doc(concat('../styles/',$citation-style, '.csl'))" />
<!-- set the citation class parameter (e.g. author-year) as specified
in the style file -->
<xsl:param name="citation-class"
select="$styles/cs:citationstyle/@class"/>
<xsl:include href="core.xsl" />
<xsl:include href="drivers.xsl" />
<xsl:include href="render-classes.xsl" />
Each of these included files in turn includes other files. So, for
example, core.xsl looks like:
<xsl:include href="core/css.xsl" />
<xsl:include href="core/functions.xsl" /> <!-- all function code -->
<xsl:include href="core/render-mods.xsl" /> <!-- all general rendering
code -->
<xsl:include href="core/style.xsl" />
The "render-classes.xsl" file looks like this:
<xsl:include href="render-classes/author-year/render.xsl"/> <!-- all
rendering code specific to author-year class -->
<xsl:include href="render-classes/note/render.xsl"/> <!-- all
rendering code specific to footnote/endnote class -->
I am using conditional statements on the class-specific templates to
keep stuff separate in processing.
Is it fine or me to be using include in this way, or is there a
compelling reason for me to be importing instead? I recall Wendell's
discussion about import precedence and such, but am not sure
practically whether this matters in this case.
Bruce