Project

Profile

Help

Bug #2218 » bug.saxon96.generatebytecode.xsl

Nick Nunes, 2014-11-12 02:43

 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all">

<xsl:param name="content-type" required="no"/>
<xsl:param name="corpus-config" required="no" select="()"/>
<xsl:template match="journal-meta">
<xsl:variable name="journal-meta.contemporary" as="element(journal-meta)"
select="$corpus-config//journal-meta"/>
<xsl:variable name="abbrev-journal-title" as="element(abbrev-journal-title)*">
<xsl:sequence
select="
(
$journal-meta.contemporary/abbrev-journal-title[@abbrev-type eq 'publisher'],
abbrev-journal-title[@abbrev-type eq 'publisher']
)[1],
abbrev-journal-title[not(@abbrev-type eq 'publisher')]
"/>
</xsl:variable>
<xsl:variable name="journal-meta.sequence" as="element()+"
select="
$abbrev-journal-title,
custom-meta-wrap"/>
<xsl:copy>
<xsl:sequence select="@*"/>
<xsl:call-template name="preserve.sibling.text">
<xsl:with-param name="element.sequence" select="$journal-meta.sequence"/>
</xsl:call-template>
</xsl:copy>
</xsl:template>
<xsl:template name="preserve.sibling.text">
<xsl:param name="element.sequence" as="element()*" required="yes"/>
<xsl:for-each select="$element.sequence">
<xsl:sequence select="preceding-sibling::node()[1][. instance of text()]"/>
<xsl:apply-templates select="." mode="#current"/>
<xsl:if test="position() eq last()">
<xsl:sequence select="parent::node()/*[last()]/following-sibling::node()[1][. instance of text()]"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
(1-1/2)