Modifying the TEI XSL stylesheets

oXygen XML editor comes with a set of TEI XSL stylesheets that can be modified to meet individual needs. You have to know a few things to be able to do it, however; things which I tend to forget again and again.

Location of TEI XSL

In oXygen 14, TEI XSL stylesheets (e. g. for transforming to XHTML) are here:

Oxygen XML Editor 14/frameworks/tei/xml/tei/stylesheet/xhtml2/tei.xsl

Including and importing XSL

Files that contain instructions to be modified have to be imported; local information (e. g. language specific) will be included:

<xsl:import href="/home/neven/Oxygen XML Editor 14/frameworks/tei/xml/tei/stylesheet/xhtml2/tei.xsl"/>
<xsl:include href="/home/neven/trunk/croala-code/xsl/i18n.xsl"/>
<xsl:include href="croala-param.xsl"/>

Modifying existing instructions

Transform element supplied to a span class=“supplied”:

    <xsl:template match="tei:supplied">
        <span class="supplied">
            <xsl:apply-templates/>
        </span>
    </xsl:template>

Conditional transformation: transform element pb to a link only if it has a @facs attribute; use the value of @facs to build a hyperlink:

    <xsl:template match="tei:pb[@facs]">
        <xsl:element name="a">
            <xsl:attribute name="href">
                <xsl:value-of select="@facs"/>
            </xsl:attribute>
            <xsl:text>[ Facsimile pag. </xsl:text><xsl:value-of select="@n"/><xsl:text> ]</xsl:text>
        </xsl:element>
    </xsl:template>
 
z/tei-xsl.txt · Last modified: 03. 01. 2013. 18:44 by njovanov
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki