Ok -- my guess is that the reason that the hathi-id is not available is because it is defined out of scope. The id should be defined within the template that you wish to access it -- or it needs to be defined outside of the for-each block so that it can be defined globally. However, a global variable really isn't what would be idea -- the id should be defined specifically within the template where it is called.
--TR
> -----Original Message-----
> From: MarcEdit support in technical and instructional matters
> [mailto:[log in to unmask]] On Behalf Of KREYCHE, MICHAEL
> Sent: Monday, April 05, 2010 10:49 AM
> To: [log in to unmask]
> Subject: Re: [MARCEDIT-L] xsl modification to copy OAI identifier to
> MARC field
>
> Hi, Terry,
>
> Yes, setting a variable ought to be simple enough but I'm having
> trouble with it. This is the first time I'm trying to do anything real
> with XSLT and maybe it's too complicated a thing to be starting out
> with.
>
> The id is in ListRecords/record/header/identifier so I made a little
> addition to OAIMARC21XML.xsl here:
>
> <xsl:template name="OAI-PMH">
> <xsl:for-each
> select="ListRecords/record/header/identifier">
> <xsl:variable name="hathi-id" select="."/>
> </xsl:for-each>
> <xsl:for-each
> select="ListRecords/record/metadata/marc:record">
> <xsl:apply-templates />
> </xsl:for-each>
> <xsl:for-each
> select="GetRecord/record/metadata/marc:record">
> <xsl:apply-templates />
> </xsl:for-each>
> </xsl:template>
>
> When I try to reference the variable I get the message "Variable
> 'hathi-id' has not been declared" (this is not in the MARCedit
> environment, I'm using a standalone processor so I can get diagnostics.
> In this particular case I tried to put the id in an 001 field (prefixed
> by the string "test") immediately after the leader:
>
> <xsl:template match="marc:leader">
> <marc:leader><xsl:value-of select="." /></marc:leader>
> <marc:controlfield tag="001">test<xsl:value-of select="$hathi-
> id"/></marc:controlfield>
> </xsl:template>
>
> If you have any suggestions I'm all ears!
>
> Thanks,
> Mike
>
> > Date: Mon, 29 Mar 2010 08:29:09 -0700
> > From: "Reese, Terry" <[log in to unmask]>
> > Subject: Re: xsl modification to copy OAI identifier to MARC field
> >
> > Basically, if it was me -- I'd setup a variable in the xsl to
> > capture the value and then use that value to build the new
> > field. I've not looked at their data in a while -- what's
> > the field that you want to stor as an identifier and to where?
> >
> > --TR
> >
> > -----Original Message-----
> > From: MarcEdit support in technical and instructional matters
> > [mailto:[log in to unmask]] On Behalf Of KREYCHE, MICHAEL
> > Sent: Monday, March 29, 2010 6:59 AM
> > To: [log in to unmask]
> > Subject: [MARCEDIT-L] 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 MARCEDIT-L-
> [log in to unmask] To unsubscribe, send a message "SIGNOFF
> MARCEDIT-L" to [log in to unmask]
________________________________________________________________________
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]
|