Sorry to take so long; I got the message (forwarded) on the 26th, but
didn't have access to the subscribed e-mail account until now. Here's
the approach I use:
<xsl:key name="mods.id" match="mods:mods" use="concat('#',@ID)"/>
<xsl:template match="mods:name">
<xsl:choose>
<xsl:when test="mods:namePart">
<xsl:apply-templates select="mods:namePart"/>
</xsl:when>
<xsl:when test="@xlink:href">
<xsl:apply-templates select="key(@xlink:href)/mods:name"/>
</xsl:when>
</xsl:choose>
</xsl:template>
Information local to the current node is given priority, then linked
name records are searched recursively. The key assumes all name records
are in the document being transformed as in the earlier example. If
they're located elsewhere, you can still do it with a vanilla XSLT
processor:
...
<xsl:when test="@xlink:href">
<xsl:variable name="idref"
select="substring-after(@xlink:href,'#')"/>
<xsl:apply-templates
select="document(substring-before(@xlink:href,'#'))//mods:mods[@ID=$idref]/mods:name"/>
</xsl:when>
...
--Andy
>>> [log in to unmask] 2003-12-26 18:40:42 >>>
Andy,
In your xlink example below, how would you handle this in XSLT? Say
you
want to create HTML output that correctly pulls in the linked name
information. Should an XSLT processor automatically handle this
without
specific coding for it?
Bruce
On Mon, 22 Dec 2003 14:58:20 -0500, "Andrew E Switala"
<[log in to unmask]> said:
> A question: How does <displayForm> fit into this? In the
> <modsCollection> I've been compiling, each person or organization has
a
> record, which each work references, and the name as it appears in
> <displayForm>, as in the fictional example:
>
> <mods>
> <titleInfo>
> <title>Names are a pain in the butt</title>
> </titleInfo>
> <name xlink:href="#name.Robert.Smith">
> <role><roleTerm type="code">aut</roleTerm></role>
> <displayForm>Bob Smith</displayForm>
> </name>
> </mods>
> <!-- Somewhere else in the file: -->
> <mods ID="name.Robert.Smith">
> <name type="personal">
> <namePart type="family">Smith</namePart>
> <namePart type="given">Robert</namePart>
> </name>
> <note type="biographical">...</note>
> <!-- and so forth -->
> </mods>
|