Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SLUB_SIP_Builder
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Digital Preservation
SLUB_SIP_Builder
Commits
0a898be3
Commit
0a898be3
authored
5 years ago
by
Jens Steidl
Browse files
Options
Downloads
Patches
Plain Diff
- use patched offline MARC21->MODS xsl
parent
2d6505a3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/slubsipbuilder.pl
+8
-7
8 additions, 7 deletions
bin/slubsipbuilder.pl
with
8 additions
and
7 deletions
bin/slubsipbuilder.pl
+
8
−
7
View file @
0a898be3
...
@@ -191,7 +191,7 @@ sub get_mods_from ($$) { # $mods = ($url, $ppn)
...
@@ -191,7 +191,7 @@ sub get_mods_from ($$) { # $mods = ($url, $ppn)
# my $marc_dc_url = 'http://www.loc.gov/standards/marcxml/xslt/MARC21slim2RDFDC.xsl';
# my $marc_dc_url = 'http://www.loc.gov/standards/marcxml/xslt/MARC21slim2RDFDC.xsl';
my
$marc_mods_url
=
'
http://www.loc.gov/standards/mods/v3/MARC21slim2MODS3-6.xsl
';
my
$marc_mods_url
=
'
http://www.loc.gov/standards/mods/v3/MARC21slim2MODS3-6.xsl
';
my
$marc_mods_path
=
$xsl_dir
.
basename
(
$marc_mods_url
);
my
$marc_mods_path
=
$xsl_dir
.
basename
(
$marc_mods_url
);
my
$marc_mods_
modifi
ed_path
=
$xsl_dir
.
basename
(
$marc_mods_url
,
"
.xsl
")
.
"
.
modifi
ed.xsl
";
my
$marc_mods_
patch
ed_path
=
$xsl_dir
.
basename
(
$marc_mods_url
,
"
.xsl
")
.
"
.
patch
ed.xsl
";
my
$marc_utils_url
=
'
http://www.loc.gov/standards/marcxml/xslt/MARC21slimUtils.xsl
';
my
$marc_utils_url
=
'
http://www.loc.gov/standards/marcxml/xslt/MARC21slimUtils.xsl
';
my
$marc_utils_path
=
$xsl_dir
.
basename
(
$marc_utils_url
);
my
$marc_utils_path
=
$xsl_dir
.
basename
(
$marc_utils_url
);
...
@@ -212,7 +212,7 @@ sub get_mods_from ($$) { # $mods = ($url, $ppn)
...
@@ -212,7 +212,7 @@ sub get_mods_from ($$) { # $mods = ($url, $ppn)
}
}
# check MARC21->MODS xsl
# check MARC21->MODS xsl
if
(
!
-
f
$marc_mods_path
)
{
if
(
!
-
f
$marc_mods_
patched_
path
)
{
say
"
Downloading MARC21->MODS xsl '
$marc_mods_url
'
";
say
"
Downloading MARC21->MODS xsl '
$marc_mods_url
'
";
my
$result
=
$ua
->
get
(
$marc_mods_url
);
my
$result
=
$ua
->
get
(
$marc_mods_url
);
if
(
$result
->
is_error
)
{
if
(
$result
->
is_error
)
{
...
@@ -224,8 +224,9 @@ sub get_mods_from ($$) { # $mods = ($url, $ppn)
...
@@ -224,8 +224,9 @@ sub get_mods_from ($$) { # $mods = ($url, $ppn)
my
$xsl_modified
=
$xsl
;
my
$xsl_modified
=
$xsl
;
$xsl_modified
=~
s#$marc_utils_url#$marc_utils_path#g
;
$xsl_modified
=~
s#$marc_utils_url#$marc_utils_path#g
;
say
"
Saving MARC21->MODS xsl to file '
$marc_mods_path
'
";
say
"
Saving MARC21->MODS xsl to file '
$marc_mods_path
'
";
write_file
(
$marc_mods_
modifi
ed_path
,
$xsl_modified
);
write_file
(
$marc_mods_
patch
ed_path
,
$xsl_modified
);
}
}
my
$srubase
=
$url
;
# host
my
$srubase
=
$url
;
# host
my
$srusearchkey
=
"
pica.ppn
";
my
$srusearchkey
=
"
pica.ppn
";
my
$sruvalue
=
$ppn
;
my
$sruvalue
=
$ppn
;
...
@@ -255,15 +256,15 @@ sub get_mods_from ($$) { # $mods = ($url, $ppn)
...
@@ -255,15 +256,15 @@ sub get_mods_from ($$) { # $mods = ($url, $ppn)
write_file
("
DEBUG_
${ppn}
_marc.xml
",
$marcblob_patched
);
write_file
("
DEBUG_
${ppn}
_marc.xml
",
$marcblob_patched
);
}
}
my
$xslt
=
XML::
LibXSLT
->
new
();
my
$xslt
=
XML::
LibXSLT
->
new
();
my
$marcmods
=
XML::
LibXML
->
load_xml
(
location
=>
$marc_mods_
url
,
no_cdata
=>
1
);
my
$marcmods
=
XML::
LibXML
->
load_xml
(
location
=>
$marc_mods_
patched_path
,
no_cdata
=>
1
);
my
$stylesheet
=
$xslt
->
parse_stylesheet
(
$marcmods
);
my
$stylesheet
=
$xslt
->
parse_stylesheet
(
$marcmods
);
my
$marc
=
$parser
->
parse_string
(
$marcblob_patched
);
my
$marc
=
$parser
->
parse_string
(
$marcblob_patched
);
my
$result
=
$stylesheet
->
transform
(
$marc
);
my
$result
=
$stylesheet
->
transform
(
$marc
);
if
(
$with_debug
)
{
if
(
$with_debug
)
{
say
"
write DEBUG_
${ppn}
_unpatched_mods.xml
";
say
"
write DEBUG_
${ppn}
_unpatched_mods.xml
";
write_file
("
DEBUG_
${ppn}
_unpatched_mods.xml
",
$stylesheet
->
output_string
(
$result
));
write_file
("
DEBUG_
${ppn}
_unpatched_mods.xml
",
$stylesheet
->
output_string
(
$result
));
}
}
$result
=
patch_mods
(
$result
);
$result
=
patch_mods
(
$result
);
my
$result_string
=
$stylesheet
->
output_string
(
$result
);
my
$result_string
=
$stylesheet
->
output_string
(
$result
);
return
$result_string
;
return
$result_string
;
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment