Mods2biblio.xsl

Just an FYI that I committed a MODS to RDF (my biblio vocab)
stylesheet. I wouldn’t call it done, but it works well enough for now.

In comparing the two representations, in the full (non-normalized)
form, the formats are about equally verbose (though mine is simpler I
think). When you take advantage of RDF normalization (treating Person
and Organization structures as basically like linked objects), mine is
much more compact. The stylesheet doesn’t do this normalization,
though; it’s not easy.

Bruce

Hi Bruce,

Just an FYI that I committed a MODS to RDF (my biblio vocab)
stylesheet. I wouldn’t call it done, but it works well enough for now.

Nice, thanks!

I tried to modify the stylesheet so that it would work with SRW+MODS XML
data as returned for example here:

http://polaris.ipoe.uni-kiel.de/refs/sru.php?version=1.1&query=rec.identifier%20any%2021520%2021647%20435%2021654

But I fear that my XSLT skills are far too limited, at least I couldn’t
get it to work. I tried to replace this:


<xsl:template match=“/”>
rdf:RDF
xsl:apply-templates/
</rdf:RDF>
</xsl:template>
<xsl:template match=“m:mods”>

with this:


<xsl:template match=“srw:searchRetrieveResponse”>
rdf:RDF
<xsl:apply-templates select=“srw:records”/>
</rdf:RDF>
</xsl:template>
<xsl:template match=“srw:records”>
xsl:apply-templates/
</xsl:template>
<xsl:template match=“srw:record”>
<xsl:apply-templates select=“srw:recordData/mods:mods”/>
</xsl:template>
<xsl:template match=“srw:recordData/mods:mods”>

In addition, I’ve changed every occurrence of “m:” to “mods:”, but to no
avail.

I’d appreciate any help with this.

Thanks, Matthias

<xsl:template match=“srw:searchRetrieveResponse”>
rdf:RDF
<xsl:apply-templates select=“srw:records”/>
</rdf:RDF>

In addition, I’ve changed every occurrence of “m:” to “mods:”, but to no
avail.

Yikes, you’re digging yourself further in the hole :wink:

Your confused on namespaces. All a prefix does is bind a uri to a
name. It is not meaningful in itself. So changing the prefix will have
no effect (except for maybe breaking the stylesheet because the prefix
is now unbound).

The solution to your problem is to revert to the SVN version, and just do this:

<xsl:template match="/">
rdf:RDF
<xsl:apply-templates select="//m:mods"/>
</rdf:RDF>
</xsl:template>

The “//” simply says “select all m:mods nodes no matter where they
are.” It’s generally inefficient, but probably appropriate in this
case. No need for any srw-specific templates or expressions.

Bruce

Your confused on namespaces. All a prefix does is bind a uri to a
name. It is not meaningful in itself. So changing the prefix will have
no effect

Ah, yes, thanks for the clarification!

The solution to your problem is to revert to the SVN version, and just
do this:

<xsl:template match=“/”>
rdf:RDF
<xsl:apply-templates select=“//m:mods”/>
</rdf:RDF>
</xsl:template>

The “//” simply says “select all m:mods nodes no matter where they
are.” It’s generally inefficient, but probably appropriate in this
case. No need for any srw-specific templates or expressions.

Ok, I did so, i.e., I replaced:

<xsl:template match=“/”>
rdf:RDF
xsl:apply-templates/
</rdf:RDF>
</xsl:template>

with:

<xsl:template match=“/”>
rdf:RDF
<xsl:apply-templates select=“//m:mods”/>
</rdf:RDF>
</xsl:template>

and uploaded this file as ‘srwmods2biblio.xsl’ to my server. However,
when I try the URL below, it doesn’t appear to do any transformation:

http://polaris.ipoe.uni-kiel.de/refs/sru.php?version=1.1&query=rec.identifier%20any%2021520%2021647%20435%2021654&stylesheet=srwmods2biblio.xsl

Thanks, Matthias

Might be something with the client side XSLT?

I assume it works on the local transformation though?

Bruce

and uploaded this file as ‘srwmods2biblio.xsl’ to my server.
However, when I try the URL below, it doesn’t appear to do any
transformation:

Might be something with the client side XSLT?

Probably. But does the URL given in my last mail work for you? (I.e.,
does SRW+MODS XML get transformed into Biblio RDF on your machine?)

I assume it works on the local transformation though?

It seems so, yes. Using this command:

java -jar /Users/msteffens/bin/saxonb8-4/saxon8.jar -o biblio-rdf.xml srwmods-data.xml srwmods2biblio.xsl

I get a transformation to RDF like this:

<rdf:RDF xmlns=“http://purl.org/net/biblio#” xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#”>





A
Bochert


1


Klassifikation von Radarsatellitendaten zur Meereiserkennung mit Hilfe von Line-Scanner-Messungen
1996


Alfred-Wegener Institut für Meeres- und Polarforschung
Bremerhaven



Matthias

Might be something with the client side XSLT?

Probably. But does the URL given in my last mail work for you? (I.e.,
does SRW+MODS XML get transformed into Biblio RDF on your machine?)

No. IIRC, Mozilla, for example, only does transforms if you have an
extension (.xml?). Or there may be some other thing that triggers it.

I assume it works on the local transformation though?

It seems so, yes. Using this command:

Yup; good.

Bruce