Change2change.xslt

The P5 element is significantly different than the P4 element. This stylesheet reads in a TEI P4 XML file and writes out the same file but with P5-format elements. It is not really intended to be used on its own, but rather the intent is for the main template to be copied and pasted (with appropriate attribution and GPL or LGPL licensing, etc., etc.) into a larger P4-to-P5 framework. 

 

     

       <xsl:otherwise> <xsl:value-of select="./date/text"/> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="who"> <xsl:if test="count(./respStmt/name)>1"> <xsl:message> warning: more than one &lt;name> child of &lt;respStmt>, using the first </xsl:message> </xsl:if> <xsl:variable name="respName"> <xsl:choose> <xsl:when test="./respStmt/name/@key"> <xsl:value-of select="./respStmt/name/@key"/> </xsl:when> <xsl:when test="./respStmt/name/@reg"> <xsl:value-of select="./respStmt/name/@reg"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="./respStmt/name/text"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="respVal" select='translate(normalize-space($respName),"-,&apos;&amp;#$%^!~`={}[]&lt;&gt;?/:; +=\|@","-")'/> <xsl:text>#</xsl:text> <xsl:value-of select="$respVal"/> </xsl:attribute> <xsl:apply-templates select="./item/*|./item/text|./item/processing-instruction|./item/comment"/> </xsl:element> </xsl:template>

</xsl:stylesheet>

Syd 06:51, 26 May 2006 (BST)