[25242] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
| 2 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:java="http://xml.apache.org/xslt/java" xmlns:tmx="http://www.lisa.org/tmx14">
|
---|
| 3 | <!-- The necessity for using xml namespaces all over and matching on namespaced element names http://www.stylusstudio.com/xsllist/200302/post70120.html -->
|
---|
| 4 |
|
---|
| 5 | <xsl:output method="text" encoding="UTF-16"/> <!-- When we save as txt from Excel, we choose UTF-16 too -->
|
---|
| 6 |
|
---|
| 7 | <xsl:template match="tmx:tmx">
|
---|
| 8 | <xsl:apply-templates select="tmx:body"/>
|
---|
| 9 | </xsl:template>
|
---|
| 10 |
|
---|
| 11 | <xsl:template match="tmx:body">
|
---|
| 12 | <xsl:text>Key	Text</xsl:text>
|
---|
| 13 | <xsl:text> </xsl:text> <!--2 newlines-->
|
---|
| 14 | <xsl:apply-templates select="tmx:tu"/>
|
---|
| 15 | </xsl:template>
|
---|
| 16 |
|
---|
| 17 | <xsl:template match="tmx:tu">
|
---|
| 18 | <xsl:for-each select="tmx:tuv">
|
---|
| 19 | <xsl:if test="tmx:prop[@type='source']">
|
---|
| 20 | <xsl:text>source::</xsl:text>
|
---|
| 21 | <xsl:value-of select="tmx:prop"/>
|
---|
| 22 | <xsl:text>	</xsl:text><!-- tab -->
|
---|
| 23 | <xsl:variable name="tempText1"><xsl:value-of select="tmx:seg"/></xsl:variable>
|
---|
| 24 | <xsl:variable name="tempText2" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, "&#10; ", "\n")'/>
|
---|
| 25 | <xsl:variable name="tempText3" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText2, "&lt;", "<")'/>
|
---|
| 26 | <xsl:variable name="tempText4" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText3, "&gt;", ">")'/>
|
---|
| 27 | <xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText4, "&amp;", "&")'/>
|
---|
| 28 | <xsl:value-of select='$escapedText' disable-output-escaping="yes"/>
|
---|
| 29 | <xsl:text> </xsl:text><!-- newline -->
|
---|
| 30 | </xsl:if>
|
---|
| 31 | </xsl:for-each>
|
---|
| 32 |
|
---|
| 33 | <xsl:for-each select="tmx:tuv">
|
---|
| 34 | <xsl:if test="tmx:prop[@type='target']">
|
---|
| 35 | <xsl:text>target::</xsl:text>
|
---|
| 36 | <xsl:value-of select="tmx:prop"/>
|
---|
| 37 | <xsl:text>	</xsl:text><!-- tab -->
|
---|
| 38 | <xsl:variable name="tempText1"><xsl:value-of select="tmx:seg"/></xsl:variable>
|
---|
| 39 | <xsl:variable name="tempText2" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, "&#10; ", "\n")'/>
|
---|
| 40 | <xsl:variable name="tempText3" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText2, "&lt;", "<")'/>
|
---|
| 41 | <xsl:variable name="tempText4" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText3, "&gt;", ">")'/>
|
---|
| 42 | <xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText4, "&amp;", "&")'/>
|
---|
| 43 | <xsl:value-of select='$escapedText' disable-output-escaping="yes"/>
|
---|
| 44 | <xsl:text> </xsl:text><!-- 2 newlines -->
|
---|
| 45 | </xsl:if>
|
---|
| 46 | </xsl:for-each>
|
---|
| 47 | </xsl:template>
|
---|
| 48 |
|
---|
| 49 | </xsl:stylesheet>
|
---|