Dot-two.xslt

This stylesheet actually does two things: Note that the root element is usually  or , but does not have to be.
 * converts  to  and  to ; and
 * adds the appropriate namespace declaration to the root elment

This stylesheet takes a single optional parameter 'version', which is what will be used as the value of the version= attribute of  or . There is no default. If the parameter is not specified, no version= attribute is output. 

       <xsl:when test="local-name(.)='TEI.2' or local-name='teiCorpus.2'"> <xsl:value-of select="substring-before(local-name(.),'.2')"/> </xsl:when> <xsl:otherwise><xsl:value-of select="local-name(.)"/></xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:element name="{$newName}"> <xsl:attribute name="xmlns">http://www.tei-c.org/ns/1.0</xsl:attribute> <xsl:copy-of select="attribute::*"/> <xsl:if test="local-name='TEI.2' or local-name='teiCorpus.2'"> <xsl:if test="not($version='')"> <xsl:attribute name="version"> <xsl:value-of select="$version"/> </xsl:attribute> </xsl:if> </xsl:if> <xsl:apply-templates select="./*|./text|./processing-instruction|./comment"/> </xsl:element> </xsl:template> <xsl:template match="/teiCorpus.2/TEI.2"> <xsl:element name="TEI"> <xsl:copy-of select="@*|./*|./text|./processing-instruction|./comment"/> </xsl:element> </xsl:template> </xsl:stylesheet> Syd 06:50, 26 May 2006 (BST)