Skip to content

Commit

Permalink
transform work titles with a combination of TEI and MEI templates
Browse files Browse the repository at this point in the history
error message in the logs was: „net.sf.saxon.trans.XPathException: The
source document is in namespace http://www.music-encoding.org/ns/mei,
but none of the template rules match elements in this namespace“
  • Loading branch information
peterstadler committed Jan 4, 2018
1 parent 8f442a3 commit 6a50f40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/wdt.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ declare function wdt:works($item as item()*) as map(*) {
}, ())
},
(: Sollte beim Titel noch der Komponist etc. angegeben werden? :)
'title' := function($serialization as xs:string) as item()? {
'title' := function($serialization as xs:string) as item()* {
let $mei :=
typeswitch($item)
case xs:string return core:doc($item)/mei:mei
Expand All @@ -398,7 +398,7 @@ declare function wdt:works($item as item()*) as map(*) {
return
switch($serialization)
case 'txt' return str:normalize-space(replace(string-join(str:txtFromTEI($title-element, config:guess-language(())), ''), '\s*\n+\s*(\S+)', '. $1'))
case 'html' return wega-util:transform($title-element, doc(concat($config:xsl-collection-path, '/common_main.xsl')), config:get-xsl-params(()))
case 'html' return wega-util:transform($title-element, doc(concat($config:xsl-collection-path, '/works.xsl')), config:get-xsl-params(()))
default return core:logToFile('error', 'wdt:works()("title"): unsupported serialization "' || $serialization || '"')
},
'label-facets' := function() as xs:string? {
Expand Down
4 changes: 4 additions & 0 deletions xsl/works.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@
</xsl:element>
</xsl:template>

<xsl:template match="mei:lb">
<xsl:element name="br"/>
</xsl:template>

</xsl:stylesheet>

0 comments on commit 6a50f40

Please sign in to comment.