teacup/config/person-template.xml

35 lines
1.7 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<formTemplate collection="/person/" contentType="person">
<item name="person_id" xpath="data(/*:person/@id)" title="Person ID" type="textfield" readOnly="true"/>
<item name="person_name" xpath="/*:person/*:item_title" title="Person name" type="textfield" readOnly="false"/>
<item name="agent" xpath="/*:person/*:agent" title="Agent" type="textfield" readOnly="false"/>
<item name="gender" xpath="/*:person/*:gender" title="Gender" type="dropdown" ControlledList="bloomsbury/config/creatorGenders.xml" ItemValue="xml:id" ItemText="label" readOnly="false"/>
<item name="description" xpath="declare function local:escape-markup-item($input as item()) as item()* {
typeswitch($input)
case element() return
('&amp;lt;' || $input/local-name(),
for $att in $input/@*
return ' ' || $att/local-name() || '=&amp;quot;' || $att/normalize-space() || '&amp;quot;',
'&amp;gt;',
for $child in $input/node()
return local:escape-markup-item($child),
'&amp;lt;/' || $input/local-name() || '&amp;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 := /*:person/*:description
return local:escape-markup($desc/node())" title="Description" type="textarea" readOnly="false"/>
<item name="imageref" xpath="/*:person/*:imageref" title="Image ref" type="textfield" readOnly="false"/>
<item name="credit_line" xpath="/*:person/*:credit_line" title="Credit line" type="textfield" readOnly="false"/>
<item name="notes" xpath="/*:person/*:notes" title="Notes" type="textfield" readOnly="true" />
</formTemplate>