Skip to content
Snippets Groups Projects
Commit 9937e39c authored by Richard Lewis's avatar Richard Lewis
Browse files

Improved namespace use in opera2an XSLT

parent 8e7e8a39
Branches
No related merge requests found
......@@ -10,7 +10,8 @@
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.akomantoso.org/2.0 ./akomantoso20.xsd"
xmlns="http://www.akomantoso.org/2.0"
xmlns:an="http://www.akomantoso.org/2.0"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:date="http://exslt.org/dates-and-times"
extension-element-prefixes="date">
......@@ -24,48 +25,48 @@
<xsl:key name="singers" match="//tei:singer" use="@who" />
<xsl:template match="/">
<akomaNtoso>
<debate name="{//tei:titleStmt/tei:title}">
<an:akomaNtoso>
<an:debate name="{//tei:titleStmt/tei:title}">
<xsl:apply-templates select="//tei:front"/>
<xsl:apply-templates select="//tei:teiHeader"/>
<xsl:apply-templates select="//tei:body"/>
</debate>
</akomaNtoso>
</an:debate>
</an:akomaNtoso>
</xsl:template>
<xsl:template match="tei:castList">
<meta>
<references source="#">
<an:meta>
<an:references source="#">
<xsl:apply-templates select=".//tei:castItem"/>
<xsl:variable name="singers" select="//tei:singer" />
<xsl:apply-templates select="$singers[generate-id() = generate-id(key('singers', ./@who)[1])]" mode="singer-group" />
</references>
</meta>
</an:references>
</an:meta>
</xsl:template>
<xsl:template match="tei:castItem">
<TLCPerson id="{@xml:id}" href="/ontology/person/wagner.{@xml:id}" showAs="{@xml:id}"/>
<an:TLCPerson id="{@xml:id}" href="/ontology/person/wagner.{@xml:id}" showAs="{@xml:id}"/>
</xsl:template>
<xsl:template match="tei:singer" mode="singer-group">
<xsl:variable name="who" select="@who" />
<xsl:if test="not(//tei:castItem[@xml:id=$who])">
<TLCPerson id="{translate(@who,' ','-')}" href="/ontology/person/wagner.{translate(@who,' ','-')}" showAs="{@who}" />
<an:TLCPerson id="{translate(@who,' ','-')}" href="/ontology/person/wagner.{translate(@who,' ','-')}" showAs="{@who}" />
</xsl:if>
</xsl:template>
<xsl:template match="tei:title">
<preface>
<docTitle>
<an:preface>
<an:docTitle>
<xsl:value-of select="."/>
</docTitle>
</preface>
</an:docTitle>
</an:preface>
</xsl:template>
<xsl:template match="tei:body">
<debateBody>
<an:debateBody>
<xsl:apply-templates/>
</debateBody>
</an:debateBody>
</xsl:template>
<xsl:template name="sum-preceding-performance-time">
......@@ -104,19 +105,19 @@
<xsl:value-of select="date:add($start, date:duration($elapsed-time))" />
</xsl:variable>
<speech by="#{translate(tei:singer[1]/@who,' ','-')}" startTime="{$start-time}">
<an:speech by="#{translate(tei:singer[1]/@who,' ','-')}" startTime="{$start-time}">
<xsl:apply-templates/>
</speech>
</an:speech>
</xsl:when>
<xsl:when test="position()=1">
<speech by="#{translate(tei:singer[1]/@who,' ','-')}" startTime="$START-TIME">
<an:speech by="#{translate(tei:singer[1]/@who,' ','-')}" startTime="$START-TIME">
<xsl:apply-templates/>
</speech>
</an:speech>
</xsl:when>
<xsl:otherwise>
<speech by="#{translate(tei:singer[1]/@who,' ','-')}">
<an:speech by="#{translate(tei:singer[1]/@who,' ','-')}">
<xsl:apply-templates/>
</speech>
</an:speech>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
......@@ -144,7 +145,7 @@
<xsl:for-each select="*[generate-id() = generate-id(key('stageKey', concat(generate-id(..), '|', generate-id(preceding-sibling::tei:stage[1])))[1])]">
<xsl:apply-templates select="preceding-sibling::tei:stage[1]" />
<xsl:element name="speech">
<xsl:element namespace="http://www.akomantoso.org/2.0" name="speech">
<xsl:attribute name="by">#<xsl:value-of select="translate(../tei:singer[1]/@who,' ','-')" /></xsl:attribute>
<xsl:if test="position()=1"><xsl:attribute name="startTime"><xsl:value-of select="$start-time" /></xsl:attribute></xsl:if>
<xsl:apply-templates select="../tei:singer[1]" />
......@@ -156,7 +157,7 @@
<xsl:variable name="first" select="position()=1" />
<xsl:for-each select="*[generate-id() = generate-id(key('stageKey', concat(generate-id(..), '|', generate-id(preceding-sibling::tei:stage[1])))[1])]">
<xsl:apply-templates select="preceding-sibling::tei:stage[1]" />
<xsl:element name="speech">
<xsl:element namespace="http://www.akomantoso.org/2.0" name="speech">
<xsl:if test="$first"><xsl:attribute name="startTime"><xsl:value-of select="$START-TIME" /></xsl:attribute></xsl:if>
<xsl:attribute name="by">#<xsl:value-of select="translate(../tei:singer[1]/@who,' ','-')" /></xsl:attribute>
<xsl:apply-templates select="../tei:singer[1]" />
......@@ -168,39 +169,39 @@
</xsl:template>
<xsl:template match="tei:stage">
<narrative>
<an:narrative>
<xsl:apply-templates/>
</narrative>
</an:narrative>
</xsl:template>
<xsl:template match="tei:singer">
<from>
<an:from>
<xsl:apply-templates/>
</from>
</an:from>
</xsl:template>
<xsl:template match="tei:lyric">
<p>
<html:p>
<xsl:apply-templates/>
</p>
</html:p>
</xsl:template>
<xsl:template match="tei:div[@type='scene']/tei:head">
<heading>
<an:heading>
<xsl:apply-templates/>
</heading>
</an:heading>
</xsl:template>
<xsl:template match="tei:div[@type='scene']">
<debateSection name="scene" id="scene{@n}">
<an:debateSection name="scene" id="scene{@n}">
<xsl:apply-templates/>
</debateSection>
</an:debateSection>
</xsl:template>
<xsl:template match="tei:musicalPrelude/tei:head">
<subHeading>
<an:subHeading>
<xsl:apply-templates/>
</subHeading>
</an:subHeading>
</xsl:template>
<xsl:template match="tei:anchor[@type='audio-cue']">
......@@ -212,7 +213,7 @@
<xsl:variable name="linkGrp" select="$link/ancestor::tei:linkGrp" />
<xsl:variable name="release">http://musicbrainz.org/release/<xsl:value-of select="substring-after($linkGrp/@domains,'http://musicbrainz.org/release/')" /></xsl:variable>
<xsl:variable name="track"><xsl:value-of select="substring-after(substring-after(substring-after($link/@target,'#'),'#'),'#')" /></xsl:variable>
<a href="{$release}#{$track}"><xsl:value-of select="substring-after($id,'#cue-')" /></a>
<html:a href="{$release}#{$track}"><xsl:value-of select="substring-after($id,'#cue-')" /></html:a>
</xsl:if>
</xsl:template>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment