{{ $piece := . }} {{ if $piece.AgentRefs }}
{{ range $agentref := $piece.AgentRefs }} {{ if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) }} {{ $agent := GetAgent $agentref.Ref }} {{- if gt (len $agent.Names) 0 -}} {{- index $agent.Names 0 -}} {{ end }} {{ end }} {{ end }}
{{ end }}
{{ if $piece.CategoryRefs }} {{ range $catref := $piece.CategoryRefs }} {{ $category := GetCategory $catref.Ref }} {{- if gt (len $category.Names) 0 -}}
{{- index $category.Names 0 -}}
{{ end }} {{ end }} {{ end }} {{ if $piece.WorkRefs }} {{ range $workref := $piece.WorkRefs }} {{ $work := GetWork $workref.Ref }} {{- if $work.PreferredTitle -}}
{{- index $work.PreferredTitle -}}
{{- else if $work.Citation.Title -}}
{{- index $work.Citation.Title -}}
{{ end }} {{ end }} {{ end }}
{{ range $annotation := $piece.AnnotationNote.Annotations }}
{{ $annotation.Inner.InnerXML }}
{{ end }}