Re: [xsl] dynamically applying templates

Subject: Re: [xsl] dynamically applying templates
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Wed, 15 Sep 2004 14:46:33 -0400
Thanks Wendell (again!). A couple of minor things below:

On Sep 15, 2004, at 2:05 PM, Wendell Piez wrote:

Accordingly, change this template to read:

<xsl:template match="/">
  <html>
    <div>
      <xsl:apply-templates/>
   </div>
  </html>
</xsl:template>

.... and add a template to match mods:mods (but notice I pulled the mode, imagining that the "bibliography" mode is to handle nodes in the config document.

I'll explain this more fully below, but the original (non-configurable) version of the stylesheets had two modes that mods:mods was invoked in: bibliography and citation.


Within those templates, there were two core modes: full and short. Originally, I had carried the citation/bibliography thing through the descendants, but that doesn't really make much sense when you consider footnote citations are often full bib references. Hence, full and short (for titles, names, etc.).

I tend to think this logic makes sense to keep.

That's the template where we'll jump trees, so --

<xsl:template match="mods:mods">
<xsl:apply-templates select="$style-biblio/cs:entry/cs:reftype[@name='book']"
mode="bibliography">
<!-- of course the value 'book' should probably be parameterized -->

How and why? ;-)


Note: I do have a function (again, with Jeni's help) that determines the type of mods record (book, etc.), but I've not thought about whether and how to bring that over to the cs:* stuff. There the type is just a straight attribute value.

    <xsl:with-param name="source" select="."/>
    <!-- this is where we jump to the other tree, carrying the original
       context with us as the $source -->

Original context is mods:mods? I am jumping to the other tree with the select statement on the apply-templates, and then jumping back to mods:mods using the with-param select?


Also, a niggle: any particular reason why your configuration couldn't be

<bibliography author-as-sort-order="yes">
  <entry reftype="book">
    <title font-style="italic" after=", "/>
    <creator/>
  </entry>
</bibliography>

thereby making it a bit tighter and easier to handle?

I simplified the config file a lot here to keep it as clear as possible. The full structure would be schematically:


citationstyle
	info (the metadata)
	content
		names
		terms
		citation
		bibliography

So, the business I'm dealing with here relates to just the last two, and needs to happen in two respective modes: citation and bibliography. All else are straightforward variables and parameters, which I already have pretty well figured out.

Bruce

Current Thread