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
a925797f
Commit
a925797f
authored
4 years ago
by
Jens Steidl
Browse files
Options
Downloads
Patches
Plain Diff
- refactor: removed MARCXML patching, no longer needed, removed LibXSLT dependency
parent
0839099a
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/slubsipbuilderbagit.pl
+1
-47
1 addition, 47 deletions
bin/slubsipbuilderbagit.pl
with
1 addition
and
47 deletions
bin/slubsipbuilderbagit.pl
+
1
−
47
View file @
a925797f
...
...
@@ -71,7 +71,6 @@ package SLUB::LZA::SIPBuilderBagIt;
use
Try::
Tiny
;
use
XML::
LibXML
;
use
XML::
XPath
;
use
XML::
LibXSLT
;
our
$VERBOSE
=
0
;
# print output switch 0 => on, 1 and larger = off
our
$with_debug
=
0
;
# output debug infos and files
...
...
@@ -185,8 +184,6 @@ package SLUB::LZA::SIPBuilderBagIt;
my
$key
=
shift
;
my
$schema
=
shift
;
#### get XSLT
my
$ua
=
LWP::
UserAgent
->
new
;
$ua
->
agent
("
MyApp/0.1
");
$ua
->
timeout
(
3600
);
#1h
...
...
@@ -212,17 +209,11 @@ package SLUB::LZA::SIPBuilderBagIt;
my
$recordData
=
$xp
->
findnodes_as_string
('
/*[local-name()="searchRetrieveResponse"]/*[local-name()="records"]/*[local-name()="record"]/*[local-name()="recordData"]/*
');
if
(
!
$recordData
)
{
croak
("
ERROR: Did not get any <recordData/> for PPN '
$ppn
' using '
$sru
'
");}
my
$marcblob
=
$parser
->
parse_string
(
$recordData
);
my
$marcblob_patched
=
SLUB::LZA::SIPBuilderBagIt::
patch_marc_response
(
$marcblob
);
if
(
$with_debug
)
{
say
"
write DEBUG_
${ppn}
_marc_unpatched.xml
";
SLUB::LZA::SIPBuilderBagIt::
write_file
("
DEBUG_
${ppn}
_marc_unpatched.xml
",
$marcblob
);
say
"
write DEBUG_
${ppn}
_marc.xml
";
SLUB::LZA::SIPBuilderBagIt::
write_file
("
DEBUG_
${ppn}
_extracted_marc_record.xml
",
$marcblob
);
}
return
$marcblob_patched
->
toString
();
return
$marcblob
;
}
else
{
carp
("
Problem asking catalogue at
$url
using
$ppn
");
...
...
@@ -246,43 +237,6 @@ package SLUB::LZA::SIPBuilderBagIt;
return
1
;
}
sub
patch_marc_response
($){
if
(
!
defined
$_
[
0
])
{
croak
"
marcobject not defined!
";
}
if
(
$_
[
0
]
eq
""){
die
"
invalid parameters.
";
}
my
$marcobj
=
shift
;
# marcobj expected as XML Parser object
my
$xslt_patch_string
=
<<
'
PATCH2
';
<
?
xml
version
=
"
1.0
"
encoding
=
"
UTF-8
"?
>
<
xsl:stylesheet
xmlns:xsl
=
"
http://www.w3.org/1999/XSL/Transform
"
xmlns:xs
=
"
http://www.w3.org/2001/XMLSchema
"
xmlns
=
"
http://www.loc.gov/MARC21/slim
"
xmlns:srw
=
"
http://www.loc.gov/zing/srw/
"
exclude
-
result
-
prefixes
=
"
srw
"
version
=
"
1.0
"
>
<
xsl:template
match
=
"
/record
"
>
<
xsl:element
name
=
"
collection
"
>
<
xsl:element
name
=
"
record
"
namespace
=
"
http://www.loc.gov/MARC21/slim
"
>
<
xsl:apply
-
templates
select
=
"
@*
"
/>
<
xsl:apply
-
templates
select
=
"
node()
"
/>
</
xsl:element
>
</
xsl:element
>
</
xsl:template
>
<
xsl:template
match
=
"
*
"
>
<
xsl:element
name
=
"
{local-name()}
"
namespace
=
"
http://www.loc.gov/MARC21/slim
"
>
<
xsl:apply
-
templates
select
=
"
node() | @*
"
/>
</
xsl:element
>
</
xsl:template
>
<
xsl:template
match
=
"
@*
"
>
<
xsl:attribute
name
=
"
{local-name()}
"
>
<
xsl:value
-
of
select
=
"
.
"
/>
</
xsl:attribute
>
</
xsl:template
>
</
xsl:stylesheet
>
PATCH2
my
$xslt
=
XML::
LibXSLT
->
new
();
my
$xslt_patch
=
XML::
LibXML
->
load_xml
(
string
=>
$xslt_patch_string
,
no_cdata
=>
1
);
my
$stylesheet
=
$xslt
->
parse_stylesheet
(
$xslt_patch
);
my
$result
=
$stylesheet
->
transform
(
$marcobj
);
return
$result
;
}
sub
generateBagName
($$$){
my
$file_date
=
$_
[
0
];
...
...
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