Subject: Re: [xsl] dynamically applying templates From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx> Date: Mon, 13 Sep 2004 20:13:02 -0400 |
Unless you have mods:titleInfo elements somewhere in your input (either in the source file or in a configuration) ... no.
Select the config template and perform the mapping you want:
<xsl:template match="cs:title[parent::reftype/@name='book' and ancestor::bibliography/@author-as-sort-order='yes'> <mods:titleInfo> Creates whatever output you want for this kind of title here; make generic, if you like, by including values of @after and so forth in place of literals.... </mods:titleInfo> </xsl:template>
input --> file.xsl <-- config | | v output
where the node you are matching is in your config file:
<bibliography author-as-sort-order="yes"> <entry> <reftype name="book"> <title font-style="italic" after=", "/> <creator/> </reftype> </entry> </bibliography>
<doc> <mods xmlns="http://www.loc.gov/mods/v3"> <name type="personal"> <namePart type="given">Jane</namePart> <namePart type="family">Doe</namePart> </name> <titleInfo> <title>Main Title</title> <subTitle>Subtitle</subTitle> </titleInfo> </mods> </doc>
<xsl:template match="cs:title"> <xsl:apply-templates select="//mods:titleInfo" mode="bib"/> </xsl:template> ... <xsl:template match="mods:titleInfo" mode="bib"> <span class="title"> <xsl:apply-templates/> </span> </xsl:template>
This won't work because that second template is not a mods:titleInfo element, and it won't ever be processed as such. It will only be applied if a mods:titleInfo node somewhere is selected (in mode 'bib'). (You could select a node from the stylesheet itself for processing, but any node addressed as "//mods:titleInfo" is going to be in the primary source; plus it's got the wrong name.)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] dynamically applying temp, Wendell Piez | Thread | Re: [xsl] dynamically applying temp, Wendell Piez |
Re: [xsl] How show Chinese an Japan, J.Pietschmann | Date | [xsl] Inserting leaf node names as , Hemanth Singamsetty |
Month |