Created
January 2, 2011 16:38
-
-
Save thevery/762634 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/> | |
<xsl:variable name="with" select="'translation.xml'"/> | |
<xsl:template match="@* | node()"> | |
<xsl:copy> | |
<xsl:apply-templates select="@* | node()"/> | |
</xsl:copy> | |
</xsl:template> | |
<xsl:template match="/resources/string"> | |
<xsl:copy> | |
<xsl:apply-templates select="@*"/> | |
<xsl:variable name="info" | |
select="document($with)/resources/string[src/node()=current()/node()]/."/> | |
<xsl:choose> | |
<xsl:when test="$info"> | |
<xsl:copy-of select="$info/dst/node()"/> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:copy-of select="current()/node()"/> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:copy> | |
</xsl:template> | |
</xsl:transform> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment