On Sep 13, 2004, at 2:16 PM, Wendell Piez wrote:
I'm saying, in effect, there's nothing preventing you from selecting
nodes in your config file, and matching them with templates, to
achieve "dynamic template selection" if you want.
So you're saying match the config template and apply to mods with
something like the following?
<xsl:template match="cs:title">
<xsl:apply-templates select="//mods:titleInfo"/>
</xsl:template>
I'm really not getting how to put this all together. For example, if I
try to experiment with this approach, I get nowhere because the
following code (the template at the bottom) is invalid:
<!-- 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($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:variable name="style-citation"
select="$styles/cs:citationstyle/cs:content/cs:citation"/>
<xsl:variable name="style-biblio"
select="$styles/cs:citationstyle/cs:content/cs:bibliography"/>
<xsl:template match="$style-biblio">
<xsl:apply-templates select="cs:*"/>
</xsl:template>
If I try something like this instead, I don't seem to be matching
templates:
<xsl:template match="//cs:bibliography">
<test>
<xsl:apply-templates select="cs:*"/>
</test>
</xsl:template>
<xsl:template match="cs:title">
<xsl:apply-templates select="//mods:titleInfo" mode="bib"/>
</xsl:template>
<xsl:template match="cs:creator">
<xsl:apply-templates select="//mods:name" mode="bib"/>
</xsl:template>
<xsl:template match="mods:titleInfo" mode="bib">
<span class="title">
<xsl:apply-templates/>
</span>
</xsl:template>
<xsl:template match="mods:name" mode="bib">
<span class="name">
<xsl:apply-templates/>
</span>
</xsl:template>