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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Digital Preservation
SLUB_SIP_Builder
Commits
8ea49d23
Commit
8ea49d23
authored
4 years ago
by
Jens Steidl
Browse files
Options
Downloads
Patches
Plain Diff
- added seperate marc21 to mods transformation
parent
3a4973c5
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/slubsipbuilderbagit.pl
+30
-0
30 additions, 0 deletions
bin/slubsipbuilderbagit.pl
with
30 additions
and
0 deletions
bin/slubsipbuilderbagit.pl
+
30
−
0
View file @
8ea49d23
...
@@ -188,6 +188,36 @@ package SLUB::LZA::SIPBuilderBagIt;
...
@@ -188,6 +188,36 @@ package SLUB::LZA::SIPBuilderBagIt;
return
;
return
;
}
}
sub
get_mods_from_marc21
($)
{
if
(
!
$_
[
0
]){
croak
"
marc21 empty!
";
}
my
$marc21
=
shift
;
my
$ua
=
LWP::
UserAgent
->
new
;
$ua
->
agent
("
MyApp/0.1
");
$ua
->
timeout
(
3600
);
#1h
my
$xsl_dir
=
SLUB::LZA::SIPBuilderBagIt::
check_xsl_directory
();
SLUB::LZA::SIPBuilderBagIt::
check_marc21_mods_xsl
(
$xsl_dir
,
$ua
);
my
$marc_mods_patched_path
=
SLUB::LZA::SIPBuilderBagIt::
check_marc21_mods_xsl
(
$xsl_dir
,
$ua
);
my
$xslt
=
XML::
LibXSLT
->
new
();
my
$marcmods
=
XML::
LibXML
->
load_xml
(
location
=>
$marc_mods_patched_path
,
no_cdata
=>
1
);
my
$stylesheet
=
$xslt
->
parse_stylesheet
(
$marcmods
);
my
$parser
=
XML::
LibXML
->
new
();
my
$marc
=
$parser
->
parse_string
(
$marc21
);
my
$result
=
$stylesheet
->
transform
(
$marc
);
my
$mods
=
$stylesheet
->
output_string
(
$result
);
my
$mods_patched
=
$stylesheet
->
output_string
(
patch_mods
(
$result
)
);
if
(
$with_debug
)
{
say
"
write DEBUG_mods_unpatched.xml
";
SLUB::LZA::SIPBuilderBagIt::
write_file
("
DEBUG_mods_unpatched.xml
",
$mods
);
say
"
write DEBUG_mods.xml
";
SLUB::LZA::SIPBuilderBagIt::
write_file
("
DEBUG_mods.xml
",
$mods_patched
);
}
return
$mods_patched
;
}
sub
write_file
($$){
sub
write_file
($$){
if
(
!
defined
$_
[
0
])
{
croak
"
filename not defined!
";
}
if
(
!
defined
$_
[
0
])
{
croak
"
filename not defined!
";
}
if
(
!
defined
$_
[
1
])
{
croak
"
value not defined!
";
}
if
(
!
defined
$_
[
1
])
{
croak
"
value not defined!
";
}
...
...
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