78 lines
4.9 KiB
XML
78 lines
4.9 KiB
XML
|
<formTemplate collection="/BCH/content/main/eBooks" contentType='book'>
|
||
|
<!-- @xpath will be resolved against each item in the collection, to pre-populate the field -->
|
||
|
<item name="bookid" xpath="/*:book/@xml:id" title="BookID" readOnly="true" type="textfield"/>
|
||
|
<item name="title" xpath="/*:book/*:info/*:title" title="Title" readOnly="true" type="textfield"/>
|
||
|
|
||
|
<!-- @occurs specifies whether is the field is optional and/or repeatable: allowed values ?, +, * -->
|
||
|
<!-- <item name="author" xpath="string-join(/*:book/*:info/(*:authorgroup/*:author/(* except *:personblurb)|*:author/(* except *:personblurb)) , ' , ')" occurs="+" title="Author" readOnly="false" type="textfield"/>-->
|
||
|
|
||
|
<group xpath="/*:book/*:info/(*:authorgroup/*:author|*:author)" name="authors" title="Authors" subgroup="author">
|
||
|
<item xpath="string-join(*:personname/*, ' ')" name="author_name" title="Name" type="textfield" readOnly="true"/>
|
||
|
</group>
|
||
|
|
||
|
<item name="pubdate" xpath="/*:book/*:info/*:pubdate" title="Original publication date" assert=". castable as xs:gYear" type="textfield" readOnly="true"/>
|
||
|
|
||
|
<item name="edition" xpath="/*:book/*:info/*:edition/@role" title="Edition" readOnly="true" type="textfield"/>
|
||
|
|
||
|
<item name="xml-isbn" xpath="/*:book/*:info/*:biblioset[@role='isbns']/*:biblioid[@class='isbn'][@role='xml']" title="XML ISBN" type="textfield" readOnly="true"/>
|
||
|
|
||
|
<item name="Print-ISBN" xpath="/*:book/*:info/*:biblioset[@role='isbns']/*:biblioid[@class='isbn'][@role='hardback']" type="textfield" title="Print ISBN" readOnly="true" />
|
||
|
|
||
|
<!-- now some fields that didn't exist in the source: -->
|
||
|
<!-- use @assert to specify some datatyping or other bespoke validation: -->
|
||
|
|
||
|
<item name="publisher" xpath="/*:book/*:info/*:biblioset[@role='publisher']/*:publisher[1]/*:publishername" title="Publisher" type="textfield" readOnly="true"/>
|
||
|
|
||
|
<item name="buylink" xpath="let $publisher := /*:book/*:info/*:biblioset[@role='publisher']/*:publisher[1]/*:publishername
|
||
|
let $printIsbn := replace(/*:book/*:info/*:biblioset[@role='isbns']/*:biblioid[@role='hardback'], '-', '')
|
||
|
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"/>
|
||
|
|
||
|
<item name="copyright" xpath="/*:book/*:info/*:copyright/*:holder" title="Copyright" type="textfield" readOnly="true"/>
|
||
|
|
||
|
<item name="Seriestitle" xpath="/*:book/*:info/*:biblioset[@role='series']/*:title[@role='series']" title="Series title" readOnly="true" type="textfield"/>
|
||
|
|
||
|
<item name="sams-id" xpath="let $book_id := /*:book/@xml:id return fn:string-join(fn:collection('/bloomsbury/products/')/*:product[*:contents/*:content/*:item/@id/string()=$book_id]/@name/string(), ' , ')" title="SAMS ID" readOnly="true" type="textfield"/>
|
||
|
|
||
|
<item name="doi" xpath="/*:book/*:info/*:biblioid[@class='doi']" title="DOI (book)" readOnly="true" type="textfield"/>
|
||
|
<!--item name="sourceContentType" title="Source Content Type" xpath="collection('bch/content-management')/*:metadata[@id = $bookId]/*:contentType/@source"/>
|
||
|
<item name="productContentType" title="Platform Content Type" xpath="collection('bch/content-management')/*:metadata[@id= $bookId]/*:contentType/@ref/(substring-after(., '#'))"/-->
|
||
|
<item name="abstract" xpath="declare function local:escape-markup-item($input as item()) as item()* {
|
||
|
typeswitch($input)
|
||
|
case element() return
|
||
|
('&lt;' || $input/local-name(),
|
||
|
for $att in $input/@*
|
||
|
return ' ' || $att/local-name() || '=&quot;' || $att/normalize-space() || '&quot;',
|
||
|
'&gt;',
|
||
|
for $child in $input/node()
|
||
|
return local:escape-markup-item($child),
|
||
|
'&lt;/' || $input/local-name() || '&gt;')
|
||
|
default return $input
|
||
|
};
|
||
|
|
||
|
declare function local:escape-markup($input as item()*) as xs:string {
|
||
|
let $output :=
|
||
|
for $item in $input
|
||
|
return local:escape-markup-item($item)
|
||
|
return string-join($output)
|
||
|
};
|
||
|
|
||
|
let $desc := /*:book/*:info/*:abstract
|
||
|
return local:escape-markup($desc/node())" title="Abstract" readOnly="true" type="textarea"/>
|
||
|
|
||
|
<item name="territorialrestriction" title="Territorial restriction" readOnly="true" type="textarea" xpath=" (
|
||
|
let $isbns :=replace(/*:book/*:info/*:biblioset[@role='isbns']/*:biblioid[@class='isbn'][@role='xml'],'-','')
|
||
|
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']
|
||
|
for $desc in fn:collection('/ONIXDB/ONIX')/ONIXMessage/Product[ProductIdentifier[ProductIDType='15']/IDValue[
|
||
|
.=
|
||
|
$isbns
|
||
|
]]/NotForSale/RightsCountry
|
||
|
return $desc )" />
|
||
|
</formTemplate>
|