Subject: | |
From: | |
Reply To: | |
Date: | Tue, 13 Apr 2010 10:23:53 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
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]
|
|
|