version 1.1, 2002/05/09 07:45:55
|
version 1.5, 2002/05/12 16:48:18
|
Line 13 my $LONCAPA_metadata=(<<END);
|
Line 13 my $LONCAPA_metadata=(<<END);
|
<lastrevisiondate>1011110523</lastrevisiondate> |
<lastrevisiondate>1011110523</lastrevisiondate> |
<mime>html</mime> |
<mime>html</mime> |
<notes></notes> |
<notes></notes> |
<owner>bio@msu, bio@msu (Michigan State University), bio@msu (Michigan State University), bio@msu (Michigan State University)</owner> |
<owner>bio\@msu, bio\@msu (Michigan State University), bio\@msu (Michigan State University), bio\@msu (Michigan State University)</owner> |
<subject>Bio Information, Large Biomolecules - Intro, Large Biomolecules - Review</subject> |
<subject>Bio Information, Large Biomolecules - Intro, Large Biomolecules - Review</subject> |
<title></title> |
<title>Test title</title> |
END |
END |
|
|
|
# ---------------------------------------------------- The 16 major nsdl fields |
|
# Audience |
|
# Publisher |
|
# Contributor |
|
# Relation |
|
# Coverage |
|
# Resource Identifier |
|
# Creator |
|
# Resource Type |
|
# Date |
|
# Rights |
|
# Description |
|
# Source |
|
# Format |
|
# Subject & Keywords |
|
# Language |
|
# Title |
|
|
|
|
|
# --------------- also need educational recommended fields |
|
# http://dublincore.org/documents/2000/10/05/education-namespace/ |
|
# dc-ed:audience |
|
# dc-ed:standard Element |
|
# dc-ed:conformsTo (Qualifier to the dc:relation) |
|
# endorsement of the use of the InteractivityType, |
|
# InteractivityLevel, and TypicalLearningTime data elements (Education Category: 5.1, 5.3, and 5.9 respectively) from the IEEE Learning |
|
# Object Metadata (LOM) standard for P1484.12. |
|
|
|
|
|
# (there are also other identified cross-walk strategies for 8 other metadata |
|
# standards) |
|
# crosswalks - http://128.253.121.110/NSDLmetaWG/IntroPage.html |
|
|
|
|
#http://metamanagement.comm.nsdlib.org/overview.html#NSDL |
#http://metamanagement.comm.nsdlib.org/overview.html#NSDL |
#http://www.dlib.vt.edu/projects/OAi/marcxml/marcxml.html |
#http://www.dlib.vt.edu/projects/OAi/marcxml/marcxml.html |
#http://www.openarchives.org/OAI/openarchivesprotocol.html |
#http://www.openarchives.org/OAI/openarchivesprotocol.html |
|
# "> |
|
my $namespace='http://ExternalFunction/'; |
|
my $func = sub { |
|
my $text = shift; |
|
return uc($text); |
|
}; |
|
|
|
$tr->install_function($namespace, 'plain-text', $func); |
|
|
|
|
my $NSDL_metadata1=(<<END); |
my $NSDL_metadata1=(<<END); |
<dc xmlns="http://purl.org/dc/elements/1.1/" |
<?xml version="1.0"?> |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
<dc xmlns="http://purl.org/dc/elements/1.1/" |
xsi:schemaLocation="http://purl.org/dc/elements/1.1/ |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
http://www.openarchives.org/OAI/1.1/dc.xsd"> |
xsi:schemaLocation="http://purl.org/dc/elements/1.1 |
|
http://www.openarchives.org/OAI/1.1/dc.xsd"> |
<title>The Cornell Law Quarterly</title> |
<title>The Cornell Law Quarterly</title> |
<date>1915-1916</date> |
<date>1915-1916</date> |
<identifier>http://heinonline.org/HeinOnline/show.pl? |
<identifier>http://heinonline.org/HeinOnline/show.pl? |
Line 33 my $NSDL_metadata1=(<<END);
|
Line 78 my $NSDL_metadata1=(<<END);
|
<rights>Available by Subscription. See http://www.wshein.com</rights> |
<rights>Available by Subscription. See http://www.wshein.com</rights> |
</dc> |
</dc> |
END |
END |
|
open(OUT,'>tmpdc.xml'); |
|
print(OUT <<END); |
|
$NSDL_metadata1 |
|
END |
|
close(OUT); |
|
|
my $NSDL_metadata2=(<<END); |
my $NSDL_metadata2=(<<END); |
<dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/" |
<dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/" |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
Line 50 my $NSDL_metadata2=(<<END);
|
Line 101 my $NSDL_metadata2=(<<END);
|
</dc:dc> |
</dc:dc> |
END |
END |
|
|
|
open(OUT,'>tmploncapa.xml'); |
|
print(OUT <<END); |
|
<?xml version="1.0"?> |
|
<loncapa> |
|
$LONCAPA_metadata |
|
</loncapa> |
|
END |
|
close(OUT); |
|
|
|
# probably also want to protect dc name-space |
|
open(OUT,'>tmpl2n.xsl'); |
|
print(OUT <<END); |
|
<?xml version="1.0"?> |
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
|
<xsl:template match="loncapa"> |
|
<dc> |
|
<xsl:text> |
|
</xsl:text> |
|
<creator> |
|
<xsl:value-of select="author"/> |
|
</creator> |
|
<xsl:text> |
|
</xsl:text> |
|
<publisher><xsl:value-of select="owner"/></publisher> |
|
<xsl:text> |
|
</xsl:text> |
|
<title><xsl:value-of select="title"/></title> |
|
<xsl:text disable-output-escaping="yes"> |
|
<!-- NEED TO IMPLEMENT --> |
|
<!-- converted from LON-CAPA language tag to Dublin Core language tag --> |
|
</xsl:text> |
|
<language><xsl:value-of select="language"/></language> |
|
<xsl:text disable-output-escaping="yes"> |
|
<!-- NEED TO IMPLEMENT --> |
|
<!-- converted from LON-CAPA seconds since 1/1/1970 to standard |
|
calendar values --> |
|
</xsl:text> |
|
<date> |
|
Created: <xsl:value-of select="creationdate"/>; |
|
Last revised: <xsl:value-of select="lastrevisiondate"/> |
|
</date> |
|
<xsl:text disable-output-escaping="yes"> |
|
<!-- NEED TO IMPLEMENT --> |
|
<!-- allow some sort of mapping to Library of Congress or Dewey Decimal |
|
standard subject mapping --> |
|
</xsl:text> |
|
<subject><xsl:value-of select="subject"/></subject> |
|
<xsl:text> |
|
</xsl:text> |
|
<xsl:text disable-output-escaping="yes"> |
|
<!-- NEED TO IMPLEMENT --> |
|
</xsl:text> |
|
<audience>unknown mapping</audience> |
|
<xsl:text> |
|
</xsl:text> |
|
<xsl:text disable-output-escaping="yes"> |
|
<!-- NEED TO IMPLEMENT --> |
|
</xsl:text> |
|
<contributor>unknown mapping (coauthors?)</contributor> |
|
<xsl:text> |
|
</xsl:text> |
|
<xsl:text disable-output-escaping="yes"> |
|
<!-- NEED TO IMPLEMENT --> |
|
</xsl:text> |
|
<relation>unknown mapping... prerequisite/postrequisite info could go here</relation> |
|
<xsl:text> |
|
</xsl:text> |
|
<xsl:text disable-output-escaping="yes"> |
|
<!-- NEED TO IMPLEMENT --> |
|
</xsl:text> |
|
<coverage>unknown mapping</coverage> |
|
<xsl:text> |
|
</xsl:text> |
|
<xsl:text disable-output-escaping="yes"> |
|
<!-- NEED TO IMPLEMENT --> |
|
</xsl:text> |
|
<identifier>the gateway url</identifier> |
|
<xsl:text> |
|
</xsl:text> |
|
<xsl:text disable-output-escaping="yes"> |
|
<!-- NEED TO IMPLEMENT --> |
|
<!-- probably mapping from LON-CAPA mime typing --> |
|
</xsl:text> |
|
<resourcetype>n/a</resourcetype> |
|
<xsl:text disable-output-escaping="yes"> |
|
<!-- NEED TO IMPLEMENT --> |
|
<!-- probably mapping from LON-CAPA copyright --> |
|
</xsl:text> |
|
<rights>n/a</rights> |
|
<description><xsl:value-of select="abstract"/></description> |
|
<xsl:text> |
|
</xsl:text> |
|
# Source |
|
<xsl:text disable-output-escaping="yes"> |
|
<!-- NEED TO IMPLEMENT --> |
|
</xsl:text> |
|
<format>software and hardware needed</format> |
|
<xsl:text disable-output-escaping="yes"> |
|
<!-- NEED TO IMPLEMENT --> |
|
</xsl:text> |
|
<subjectandkeywords>need to break things into formal "classification" tag to insert keywords</subjectandkeywords> |
|
<xsl:text> |
|
</xsl:text> |
|
</dc> |
|
</xsl:template> |
|
</xsl:stylesheet> |
|
END |
|
close(OUT); |
|
|
|
# probably also want to protect dc name-space |
|
open(OUT,'>tmpn2l.xsl'); |
|
print(OUT <<END); |
|
<?xml version="1.0"?> |
|
<xsl:stylesheet |
|
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" |
|
xmlns:external="$namespace" |
|
> |
|
<xsl:template match="/"> |
|
<loncapa> |
|
<xsl:text> |
|
</xsl:text> |
|
<xsl:apply-templates select="/*/dc:*"/> |
|
</loncapa> |
|
<xsl:text> |
|
</xsl:text> |
|
</xsl:template> |
|
<xsl:template match="dc:title"> |
|
<title> |
|
<xsl:choose> |
|
<xsl:when test="function-available('external:plain-text')"> |
|
<xsl:value-of select="external:plain-text(.)"/> |
|
</xsl:when> |
|
<xsl:otherwise> |
|
Function external:plain-text() is not available! |
|
</xsl:otherwise> |
|
</xsl:choose> |
|
</title> |
|
<xsl:text> |
|
</xsl:text> |
|
</xsl:template> |
|
<xsl:template match="dc:date"> |
|
<date><xsl:value-of select="."/></date> |
|
<xsl:text> |
|
</xsl:text> |
|
</xsl:template> |
|
<xsl:template match="dc:rights"> |
|
<copyright><xsl:value-of select="."/></copyright> |
|
<xsl:text> |
|
</xsl:text> |
|
</xsl:template> |
|
<xsl:template match="dc:identifier"> |
|
<dc:identifier><xsl:value-of select="."/></dc:identifier> |
|
<xsl:text> |
|
</xsl:text> |
|
</xsl:template> |
|
</xsl:stylesheet> |
|
END |
|
close(OUT); |
|
|
|
# ---------------------------------- LON-CAPA to NSDL (Dublic Core PLUS format) |
|
my $compiled = $tr->compile_stylesheet_file("tmpl2n.xsl"); |
|
my $parsed = $tr->parse_file("tmploncapa.xml"); |
|
my $dest_file="l2n.xml"; |
|
$tr->transform_to_file($parsed, $compiled, $dest_file) |
|
or die $tr->errstr; |
|
|
|
# ---------------------------------- NSDL (Dublic Core PLUS format) to LON-CAPA |
|
my $compiled = $tr->compile_stylesheet_file("tmpn2l.xsl"); |
|
my $parsed = $tr->parse_file("tmpdc.xml"); |
|
my $dest_file="n2l.xml"; |
|
$tr->transform_to_file($parsed, $compiled, $dest_file) |
|
or die $tr->errstr; |
|
|
my $compiled = $tr->compile_stylesheet_file("foo.xsl"); |
# ---------------------------------- test |
my $parsed = $tr->parse_file("foo.xml"); |
my $compiled = $tr->compile_stylesheet_file("test1.xsl"); |
my $dest_file="abc.xml"; |
my $parsed = $tr->parse_file("test1.xml"); |
|
my $dest_file="test1out.xml"; |
$tr->transform_to_file($parsed, $compiled, $dest_file) |
$tr->transform_to_file($parsed, $compiled, $dest_file) |
or die $tr->errstr; |
or die $tr->errstr; |