Hi Bruce,
At 08:13 PM 9/13/2004, you wrote:
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>
I don't think this is what I'm looking for. I don't need to create the
mods:titleInfo output; I need to process the mods:titleInfo element that
is already there in my input source.
Ah, okay. (It helps to be able to see the source.)
input --> file.xsl <-- config
|
|
v
output
So, you have the right config file structure below, but let me add an
additional element to illustrate.
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>
A minimal input document then could be:
<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>
Note, then, that order of elements in the input file is different than
that specified in the config file, which is saying output should be:
Main Title: Subtitle, Jane Doe
So perhaps your calling template would select the appropriate cs:reftype
element in the config file to process:
<xsl:apply-templates name="style-biblio"
select="$styles/cs:citationstyle/cs:content/cs:bibliography[(_at_)author-as-sort-order='yes']/cs:entry/cs:reftype[(_at_)name='book']">
<xsl:with-param name="source" select="."/>
</xsl:apply-templates>
And then
<xsl:template match="cs:reftype">
<xsl:param name="source"/>
<xsl:apply-templates>
<xsl:with-param name="source" select="."/>
<!-- the parameter passing shouldn't be necessary w/ XSLT 2.0
'tunneling parameters' -->
</xsl:apply-templates>
</xsl:template>
<xsl:template match="cs:title">
<xsl:param name="source"/>
<!-- do your title thing here, grabbing data from
$source (the mods source) as necessary -->
...
</xsl:template>
etc.
Basically you're jumping back and forth between the trees, carrying the
data you need from one to the other so you can "graft" the branches.
<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.)
Why "wrong name"?
Sorry for the confusion here -- it's not the mods:titleInfo that has the
wrong name; it's the template itself. And you don't want to select a
*template* for processing....
Cheers,
Wendell
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================