This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Selecting Bits, Dumping the Rest
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: Selecting Bits, Dumping the Rest
- From: "Fox, Michael" <michael dot fox at mnhs dot org>
- Date: Wed, 26 Apr 2000 10:14:56 -0500
- Reply-To: xsl-list at mulberrytech dot com
John Gardner asked
> -----------What is the basic principle I'm missing here? Usually it's
> that I _can't_ get the other stuff to come through b/c I'm screwing up
> with apply-templates. Now I got it backwards! Note, I do have a
> successful establishment of the foa element based on the variables set up.
>
>
>
Try this. It achieves the output you specified. I don't follow the request
in your last paragraph
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="marc/record" >
<xsl:element name="{control-field[@tag='001']}">
<xsl:value-of select="text()" />
<xsl:for-each select="data-field [@tag='773']/subfield[@code='x']">
<issn_x>
<xsl:apply-templates select="text()" />
</issn_x>
</xsl:for-each>
<!-- this part distinguishes the first page of the article as an
"foa"element -->
<xsl:for-each select="data-field[@tag='773']/subfield[@code='g']">
<citation_g>
<xsl:apply-templates select="text()" />
<xsl:variable name="ispartof" select="normalize-space(.)"/>
<xsl:variable name="numseqs" select="substring-after($ispartof,'p. ')"/>
<xsl:variable name="start"
select="number(substring-before($numseqs,'-'))"/>
<foa>
<xsl:value-of select="$start" />
</foa>
</citation_g>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Michael
Michael Fox
Acting Assistant Director for Library and Archives
Minnesota Historical Society
345 Kellogg Blvd West
St. Paul MN 55102-1906
phone: 651-296-1014
fax: 651-296-9961
michael.fox@mnhs.org
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list