150 lines
No EOL
10 KiB
XML
150 lines
No EOL
10 KiB
XML
<!-- point to a collection to use information from the XML already stored there -->
|
|
<formTemplate collection="/SS/content" contentType="tei">
|
|
<!-- @xpath will be resolved against each item in the collection, to pre-populate the field -->
|
|
<!-- Extract volumeid value from TEI documents and it will be rendered as textfield on the UI. -->
|
|
<item name="volumeid" xpath="/*:TEI/@xml:id" type="textfield" readOnly="true" title="Volume Id"/>
|
|
|
|
<!-- Extract title value from TEI documents and it will be rendered as textfield on the UI. -->
|
|
<item name="title" xpath="/*:TEI/*:teiHeader/*:fileDesc/*:titleStmt/*:title" type="textfield" readOnly="true" title="Title"/>
|
|
|
|
<!-- Extract pubdate value from TEI documents and it will be rendered as textfield on the UI. -->
|
|
<item name="pubdate" xpath="/*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt/*:date[@type='publication']" type="textfield" title="Original publication date" assert=". castable as xs:gYear" readOnly="true" />
|
|
|
|
<!-- Extract editon value from ONIX documents and it will be rendered as textfield on the UI. -->
|
|
<item name="edition" title="Edition" readOnly="true" type="textfield" xpath="
|
|
let $isbns := /*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt
|
|
/*:idno[@type='isbn']/replace(., '[^\d]', '')
|
|
for $desc in fn:collection('/ONIXDB/ONIX')/ONIXMessage/Product[ProductIdentifier[ProductIDType='15']/IDValue[
|
|
.=
|
|
$isbns
|
|
]]/*:EditionNumber
|
|
let $doc := parse-xml('<p>'||replace($desc, '<br(/)?>', '
')||'</p>')
|
|
return xslt:transform($doc, 'transforms/desc2html.xsl')" />
|
|
|
|
<!-- Extract publication place value from ONIX documents and it will be rendered as textfield on the UI. -->
|
|
<item name="Place-of-publication" title="Place of publication" readOnly="true" type="textfield" xpath="
|
|
let $isbns := /*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt
|
|
/*:idno[@type='isbn']/replace(., '[^\d]', '')
|
|
for $desc in fn:collection('/ONIXDB/ONIX')/ONIXMessage/Product[ProductIdentifier[ProductIDType='15']/IDValue[
|
|
.=
|
|
$isbns
|
|
]]/*:CityOfPublication
|
|
let $doc := parse-xml('<p>'||replace($desc, '<br(/)?>', '
')||'</p>')
|
|
return xslt:transform($doc, 'transforms/desc2html.xsl')" />
|
|
|
|
<!-- Extract xml-isbn value from the TEI documents and it will be rendered as textfield on the UI. -->
|
|
<item name="xml-isbn" xpath="/*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt/(*:idno[@type='isbn'][@n = 'xml']|*:idno[@type='isbn'][not(@n)])/replace(., '[^\d]', '')" type="textfield" title="XML ISBN" readOnly="true" />
|
|
|
|
<!-- Extract hb-isbn value from the TEI documents and it will be rendered as textfield on the UI. -->
|
|
<item name="Print-ISBN" xpath="/*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt/*:idno[@type = 'isbn'][@n = 'paperback']" type="textfield" title="Print ISBN" readOnly="true" />
|
|
|
|
<item name="buylink" xpath="let $publisher := /*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt/*:publisher
|
|
let $printIsbn := /*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt/*:idno[@type = 'isbn'][@n = 'paperback']
|
|
let $allPublishers := fn:collection('/metadataonlycontent/publisher/')/*:publisher
|
|
let $onePublisher := $allPublishers[*:item_title[matches($publisher, .)]]
|
|
for $urlStem in $onePublisher/*:url_default
|
|
return concat($urlStem, $printIsbn)" title="Buy link" readOnly="true" type="textfield"/>
|
|
|
|
<!-- Extract Copyright value from the TEI documents and it will be rendered as textfield on the UI. -->
|
|
<item name="Copyright" xpath="/*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt/*:availability/string-join(*:ab[@type = ('copyrightYear', 'copyrightHolder')], ' ')" type="textfield" title="Copyright" readOnly="true" />
|
|
|
|
<!-- now some fields that didn't exist in the source: -->
|
|
<!-- use @assert to specify some datatyping or other bespoke validation: -->
|
|
<!-- Extract series value from ONIX documents and it will be rendered as textfield on the UI. -->
|
|
<item name="seriestitle" title="Series title" readOnly="true" type="textfield" xpath="
|
|
let $isbns := /*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt
|
|
/*:idno[@type='isbn']/replace(., '[^\d]', '')
|
|
for $desc in fn:collection('/ONIXDB/ONIX')/ONIXMessage/Product[ProductIdentifier[ProductIDType='15']/IDValue[
|
|
.=
|
|
$isbns
|
|
]]/*:Series/*:TitleOfSeries
|
|
let $doc := parse-xml('<p>'||replace($desc, '<br(/)?>', '
')||'</p>')
|
|
return xslt:transform($doc, 'transforms/desc2html.xsl')" />
|
|
|
|
<!-- Extract description value from ONIX documents and it will be rendered as textarea on the UI. -->
|
|
<!-- <item name="description" title="Description" readOnly="false" type="textarea" xpath="
|
|
let $isbns := /*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt
|
|
/*:idno[@type='isbn']/replace(., '[^\d]', '')
|
|
let $desc := fn:collection('/ONIXDB/ONIX')/ONIXMessage/Product[ProductIdentifier[ProductIDType='15']/IDValue[
|
|
.=
|
|
$isbns
|
|
]]/OtherText[TextTypeCode='01']/Text
|
|
let $doc := parse-xml('<p>'||replace($desc, '<br(/)?>', '
')||'</p>')
|
|
return xslt:transform($doc, 'transforms/desc2html.xsl')" /> -->
|
|
|
|
<item name="description" title="Description" readOnly="true" type="textarea" xpath="
|
|
let $isbns := /*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt
|
|
/*:idno[@type='isbn']/replace(., '[^\d]', '')
|
|
let $desc := fn:collection('/ONIXDB/ONIX')/ONIXMessage/Product[ProductIdentifier[ProductIDType='15']/IDValue[
|
|
.=
|
|
$isbns
|
|
]]/OtherText[TextTypeCode='01']/Text
|
|
return $desc" />
|
|
|
|
<!-- Extract authors value from ONIX documents and it will be rendered as checkbox on the UI.-->
|
|
|
|
<item name="territorialrestriction" title="Territorial restriction" readOnly="true" type="textarea" xpath=" (
|
|
let $isbns := /*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt
|
|
/*:idno[@type='isbn']/replace(., '[^\d]', '')
|
|
for $desc in fn:collection('/ONIXDB/ONIX')/ONIXMessage/Product[ProductIdentifier[ProductIDType='15']/IDValue[
|
|
.=
|
|
$isbns
|
|
]]/SalesRights[SalesRightsType = '01']/RightsCountry
|
|
return $desc , let $isbns := /*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt
|
|
/*:idno[@type='isbn']/replace(., '[^\d]', '')
|
|
for $desc in fn:collection('/ONIXDB/ONIX')/ONIXMessage/Product[ProductIdentifier[ProductIDType='15']/IDValue[
|
|
.=
|
|
$isbns
|
|
]]/NotForSale/RightsCountry
|
|
return $desc )" />
|
|
|
|
<group xpath="let $isbns := /*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt/*:idno[@type='isbn']/replace(., '[^\d]', '')
|
|
return fn:collection('/ONIXDB/ONIX/')/ONIXMessage/Product[ProductIdentifier[ProductIDType='15']/IDValue[. = $isbns]]/Contributor" name="creators" title="Creators" subgroup="creator">
|
|
<item xpath="PersonName" name="creator_name" title="Name" type="textfield" readOnly="true"/>
|
|
<item xpath="replace(replace(replace(concat('¬1', PersonNameIdentifier[PersonNameIDType = '01']/IDValue, '¬2', PersonName, '¬3'), '¬1¬2', ''), '¬2.*¬3', ''), '¬\d', '')" name="onix_id" title="ONIX ID" type="textfield" readOnly="true"/>
|
|
<item xpath="let $isbns := /*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt/*:idno[@type='isbn']/replace(., '[^\d]', '')
|
|
for $contributorRole in fn:collection('/ONIXDB/ONIX/')/ONIXMessage/Product[ProductIdentifier[ProductIDType='15']/IDValue[. = $isbns]]/Contributor/ContributorRole
|
|
return fn:doc('bloomsbury/config/creatorRoles.xml')/*:controlledList/*:name[*:onixId[@type = 'ContributorRole']/@id/string()=$contributorRole]/@xml:id" name="creator_role" title="Role" type="dropdown" ControlledList="bloomsbury/config/creatorRoles.xml" ItemValue="xml:id" ItemText="label" readOnly="true"/>
|
|
</group>
|
|
|
|
<item name="notes" xpath="let $isbns := /*:TEI/*:teiHeader/*:fileDesc/*:publicationStmt/*:idno[@type='isbn']/replace(., '[^\d]', '')
|
|
let $onix := fn:collection('/ONIXDB/ONIX/')/ONIXMessage/Product[ProductIdentifier[ProductIDType='15']/IDValue[. = $isbns]]
|
|
let $company := $onix/ancestor::ONIXMessage/Header/FromCompany
|
|
let $seriesTitle :=
|
|
if (matches($company, 'Faber'))
|
|
then 'Faber Drama'
|
|
else if ($company eq 'Playwrights Canada Press')
|
|
then $company/data()
|
|
else if ($onix/Series/TitleOfSeries)
|
|
then ($onix/Series/TitleOfSeries)[1]/data()
|
|
else ($onix/Series/Title[TitleType = '01']/TitleText)[1]/data()
|
|
let $sIdComponents := tokenize(normalize-space(replace(replace($seriesTitle, '\p{Pd}', ' '), '\p{P}', '')), '\s')
|
|
let $sIdInput :=
|
|
for $sIdComponent in $sIdComponents
|
|
return concat(upper-case(substring($sIdComponent, 1, 1)), substring($sIdComponent, 2))
|
|
let $seriesId := concat('series_', lower-case(substring(string-join($sIdInput, ''), 1, 1)), substring(string-join($sIdInput, ''), 2))
|
|
let $seriesCheck :=
|
|
if ($onix/NoSeries)
|
|
then ()
|
|
else if ($seriesId = fn:collection('/metadataonlycontent/series/')/*:series/@id)
|
|
then ()
|
|
else '**NO SERIES RECORD FOUND FOR ' || $seriesTitle || '!**'
|
|
let $authorsCheck :=
|
|
for $contrib in $onix/Contributor
|
|
let $contribName := $contrib/PersonName
|
|
let $contribId := replace(replace(replace(concat('¬1', $contrib/PersonNameIdentifier[PersonNameIDType = '01']/IDValue, '¬2', $contribName, '¬3'), '¬1¬2', ''), '¬2.*¬3', ''), '¬\d', '')
|
|
let $contribRole := fn:doc('bloomsbury/config/creatorRoles.xml')/*:controlledList/*:name[*:onixId[@type = 'ContributorRole']/@id = $contrib/ContributorRole]/@xml:id
|
|
let $personIdMapping := fn:collection('/metadataonlycontent/person/mapping/')/*:mapping[@role = 'OnixToPersonId']
|
|
let $personRef := $personIdMapping/*:item[*:instance[@company = $company][@onixId = $contribId]]/@personId/data()
|
|
return if ($contribRole eq 'author')
|
|
then if ($personRef)
|
|
then ()
|
|
else '**NO PERSON RECORD FOUND FOR ' || $contribName || '!**'
|
|
else ()
|
|
let $authorsCheck := string-join($authorsCheck, ' ')
|
|
return string-join(($seriesCheck, $authorsCheck), ' ')" type="textarea" title="Notes" readOnly="true" />
|
|
|
|
<!-- <item name="additionalrole" xpath="" title="Additional Role" readOnly="false" type="textfield"/> -->
|
|
|
|
<item name="taxonomy" controlledList="SS-taxonomy.xml" title="Index terms" occurs="+"/>
|
|
</formTemplate> |