Thanks for sharing this, Michael.
I had this on my to-do list for my hathi stylesheet and finally got
around to trying to do what you were wanting to do last weekend. Much
to my surprise, it wouldn't work and I've been banging my head against
it all week with an occasional interlude of reading Michael Kay's
reference guide.
Since the oai prefix is not in the OAI-PMH records/metadata, it seems
a little spooky! But I added the namespace and then the prefix to the
identifier element and, voilŕ!
thanks again,
dana
On Tue, Apr 13, 2010 at 9:23 AM, KREYCHE, MICHAEL <[log in to unmask]> wrote:
> I'll answer my own question here in case it proves useful to someone else.
>
> The fix was to add the OAI namespace to the stylesheet (OAIMARC21XML.xsl), assigning the namespace a prefix (the second last line is the one I added):
>
> <xsl:stylesheet version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/
> http://www.openarchives.org/OAI/2.0/oai_dc.xsd" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:oai="http://www.openarchives.org/OAI/2.0/"
> xmlns:marc="http://www.loc.gov/MARC21/slim">
>
> Now I can reference the identifier using the prefix (oai:identifier).
>
> Previously I was trying to reference the identifier without a prefix, the way it appears in the OAI-PMH xml file. The problem I ran into has to do with the different ways that xml and xsl handle unprefixed element names:
>
> In xsl an unprefixed name is always considered to not belong to a namespace.
> In xml an unprefixed name can either not belong to a namespace or belong to the default namespace, the latter being the case with the OAI file.
>
> So my stylesheet was looking for an "identifier" that didn't belong to namespace, but the element I wanted DID belong to a namespace. Putting the identifier into an 001 only requires the addition of three more lines in the stylesheet (after the leader):
>
> <xsl:template match="marc:leader">
> <marc:leader>
> <xsl:value-of select="." />
> </marc:leader>
> <marc:controlfield tag="001">
> <xsl:value-of select="substring-after(../../../oai:header/oai:identifier,'edu:')"/>
> </marc:controlfield>
> </xsl:template>
>
> The answer was staring me in the face in "XML in a Nutshell" (3rd ed., p. 159-160). I just had to read it enough times!
>
> Mike
> --
> Michael Kreyche
> Systems Librarian / Associate Professor
> Libraries and Media Services
> Kent State University
> 330-672-1918
>
>> Date: Mon, 29 Mar 2010 09:58:38 -0400
>> From: "KREYCHE, MICHAEL" <[log in to unmask]>
>> Subject: xsl modification to copy OAI identifier to MARC field
>>
>> Hello, all,
>>
>> I'm wondering if someone can help me out. I'm working with
>> the Hathi Trust records via OAI-PMH and would like to capture
>> the identifier and copy it into a MARC field by modifying the XSL.
>>
>> I was able to add a new field with fixed text, but I'm not
>> having any luck bringing in the identifier when I try to
>> reference it. Seems to me this ought to be a fairly simple
>> thing, but I don't have much XSL experience.
>>
>> Thanks,
>> Mike
>> --
>> Michael Kreyche
>> Systems Librarian / Associate Professor
>> Libraries and Media Services
>> Kent State University
>> 330-672-1918
>
> ________________________________________________________________________
>
> This message comes to you via MARCEDIT-L, a Listserv(R) list for technical and instructional support in MarcEdit. If you wish to communicate directly with the list owners, write to [log in to unmask] To unsubscribe, send a message "SIGNOFF MARCEDIT-L" to [log in to unmask]
>
--
Dana Pearson
dbpearsonmlis.com
________________________________________________________________________
This message comes to you via MARCEDIT-L, a Listserv(R) list for technical and instructional support in MarcEdit. If you wish to communicate directly with the list owners, write to [log in to unmask] To unsubscribe, send a message "SIGNOFF MARCEDIT-L" to [log in to unmask]
|