Re: [xsl] dynamically applying templates

Subject: Re: [xsl] dynamically applying templates
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Wed, 15 Sep 2004 15:30:16 -0400
On Sep 15, 2004, at 3:00 PM, Wendell Piez wrote:

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.

I don't mean to second-guess your reasoning. I just wanted to be clear that the "bibliography" mode didn't appear to be helping in this particular case. If you need it for some larger reason, fine. (Just make sure it doesn't clash with the traversal of the cs: nodes. Maybe they're the ones that don't need the mode.)

Well, the sample document is really simplified. In a real document, the bibliography mode is going to be the templates applied at the end of a long document. The other mode is going to get applied to the citations within the paragraphs.


I can only hope that this doesn't cause me further problems! I went through a lot of pain just sorting out the namespaces and modes issues a few weeks back.

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.

That might be exactly what you want.


Say if your input made the reference type explicit, <mods type="book">...</mods>, then the select expression could read select="$style-biblio/cs:entry/cs:reftype[@name=current()/@type]

.... thereby choosing whatever reftype matched the type given in the mods input.

Your function might be to do exactly this, for all I know. :->

MODS doesn't really have explicit typing, so the function does the typing. It says, in really simplistic terms, if the record has two titles and is issued once, it's a chapter; if only one title, it's a book. That way, even those things that aren't technically chapters or books but have the same characteristics get formatted fairly accurately.


I'm not really sure the implications of that for the templates; it sounds like you're suggesting it'd be easiest to have a fixed list of "types" and have a bunch of templates like the below, where mods:type is created in the temporary tree?

<xsl:template match="mods:mods[mods:type='book']">

Bruce

Current Thread