-
Notifications
You must be signed in to change notification settings - Fork 10
Metadata manipulator: AddUuidToTemplated
This metadata manipulator adds a UUID v4 to XML metadata generated by the Templated metadata parser.
Can be used within any CSV or CONTENTdm toolchain that uses a Templated Metadata Parser.
To register this manipulator in your toolchain, add the following line to the "[MANIPULATORS]" section of your .ini file:
metadatamanipulators[] = "AddUuidToTemplated|/tmp/twigtemplates/mytemplate.xml"
The only parameter is the full or relative path to the Twig template that will render the XML containing the UUID.
The only parameter is the full or relative path to the Twig template that will render the XML containing the UUID, e.g., if the Templated metadata parser generates MODS XML like this:
<?xml version="1.0"?>
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<titleInfo>
<title>Small boats in Havana Harbour on a sunny day</title>
</titleInfo>
</mods>
enabling this metadata manipulator using this template:
<identifier type="uuid">{{ UUID }}</identifier>
will result in MODS like this:
<?xml version="1.0"?>
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<titleInfo>
<title>Small boats in Havana Harbour on a sunny day</title>
</titleInfo>
<identifier type="uuid">fb677095-2eb5-4acf-b310-ad8c3d0491cd</identifier>
</mods>
Note that:
- The Twig template must contain the variable
UUID
. - This metadata manipulator does not check to see if an element containing a UUID already exists in the XML.
Content on the Move to Islandora Kit wiki is licensed under a Creative Commons Attribution 4.0 International License.