1<?xml version="1.0" encoding="utf-8"?> 2<xsl:stylesheet version="1.0" 3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 4 xmlns:lang="urn:org:tug:texhyphen:languagedata"> 5 6 <xsl:output method="xml" encoding="UTF-8" indent="yes"/> 7 8 <xsl:variable name="language-data" select="document('codemapping.xml')/lang:code-mappings"/> 9 10 <xsl:template match="*|@*|node()"> 11 <xsl:copy> 12 <xsl:apply-templates select="*|@*|node()"/> 13 </xsl:copy> 14 </xsl:template> 15 16 <xsl:template match="lang:language"> 17 <xsl:variable name="code" select="$language-data/lang:code-mapping[@code=current()/@code]"/> 18 <xsl:variable name="fop-code"> 19 <xsl:choose> 20 <xsl:when test="$code"> 21 <xsl:value-of select="$code/@fop-code"/> 22 </xsl:when> 23 <xsl:otherwise> 24 <xsl:value-of select="@code"/> 25 </xsl:otherwise> 26 </xsl:choose> 27 </xsl:variable> 28 <xsl:copy> 29 <xsl:if test="string($fop-code)"> 30 <xsl:attribute name="fop-code"> 31 <xsl:value-of select="$fop-code"/> 32 </xsl:attribute> 33 </xsl:if> 34 <xsl:apply-templates select="*|@*|node()"/> 35 </xsl:copy> 36 </xsl:template> 37 38</xsl:stylesheet> 39