1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/XSLForms/XSL/FindTranslationKeys.xsl Mon Jun 22 23:33:43 2009 +0200
1.3 @@ -0,0 +1,61 @@
1.4 +<?xml version="1.0"?>
1.5 +<!--
1.6 +Copyright (C) 2009 Paul Boddie <paul@boddie.org.uk>
1.7 +
1.8 +This program is free software; you can redistribute it and/or modify it under
1.9 +the terms of the GNU Lesser General Public License as published by the Free
1.10 +Software Foundation; either version 3 of the License, or (at your option) any
1.11 +later version.
1.12 +
1.13 +This program is distributed in the hope that it will be useful, but WITHOUT
1.14 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.15 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
1.16 +details.
1.17 +
1.18 +You should have received a copy of the GNU Lesser General Public License along
1.19 +with this program. If not, see <http://www.gnu.org/licenses/>.
1.20 +-->
1.21 +<xsl:stylesheet version="1.0"
1.22 + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1.23 + xmlns:template="http://www.boddie.org.uk/ns/xmltools/template">
1.24 +
1.25 + <xsl:output indent="yes" method="xml"/>
1.26 +
1.27 + <!-- Process the root element. -->
1.28 +
1.29 + <xsl:template match="/">
1.30 + <translations>
1.31 + <locale>
1.32 + <xsl:apply-templates select="@*|node()"/>
1.33 + </locale>
1.34 + </translations>
1.35 + </xsl:template>
1.36 +
1.37 +
1.38 +
1.39 + <!-- Handle elements with translation attributes. -->
1.40 +
1.41 + <xsl:template match="*[@template:i18n]">
1.42 + <xsl:choose>
1.43 + <xsl:when test="@template:i18n = '-'">
1.44 + <translation>
1.45 + <xsl:attribute name="value">
1.46 + <xsl:copy-of select="text()"/>
1.47 + </xsl:attribute>
1.48 + </translation>
1.49 + </xsl:when>
1.50 + <xsl:otherwise>
1.51 + <translation value="{@template:i18n}"></translation>
1.52 + </xsl:otherwise>
1.53 + </xsl:choose>
1.54 + </xsl:template>
1.55 +
1.56 +
1.57 +
1.58 + <!-- Traverse unknown nodes. -->
1.59 +
1.60 + <xsl:template match="@*|node()">
1.61 + <xsl:apply-templates select="@*|node()"/>
1.62 + </xsl:template>
1.63 +
1.64 +</xsl:stylesheet>