1.1 --- a/XSLForms/XSL/Prepare.xsl Wed Feb 28 22:29:11 2007 +0000
1.2 +++ b/XSLForms/XSL/Prepare.xsl Wed Feb 28 22:29:43 2007 +0000
1.3 @@ -4,7 +4,7 @@
1.4 stylesheet - something which is capable of transforming XML documents into Web
1.5 pages or other kinds of XML documents.
1.6
1.7 -Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2005, 2007 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This library is free software; you can redistribute it and/or
1.11 modify it under the terms of the GNU Lesser General Public
1.12 @@ -267,6 +267,8 @@
1.13 <!-- NOTE: Quoting not done completely. -->
1.14 <axsl:variable name="translation"
1.15 select="$translations/translations/locale[code/@value=$locale]/translation[@value='{text()}']/text()"/>
1.16 + <axsl:variable name="translation-default"
1.17 + select="$translations/translations/locale[1]/translation[@value='{text()}']/text()"/>
1.18 <xsl:call-template name="insert-translated-value"/>
1.19 </xsl:when>
1.20 <!-- Look for a translation based on the expression. -->
1.21 @@ -276,6 +278,8 @@
1.22 <!-- Translate according to the expression. -->
1.23 <axsl:variable name="translation"
1.24 select="$translations/translations/locale[code/@value=$locale]/translation[@value=$i18n-expr]/text()"/>
1.25 + <axsl:variable name="translation-default"
1.26 + select="$translations/translations/locale[1]/translation[@value=$i18n-expr]/text()"/>
1.27 <xsl:call-template name="insert-translated-value">
1.28 <xsl:with-param name="default">$i18n-expr</xsl:with-param>
1.29 </xsl:call-template>
1.30 @@ -285,6 +289,8 @@
1.31 <!-- NOTE: Quoting not done completely. -->
1.32 <axsl:variable name="translation"
1.33 select="$translations/translations/locale[code/@value=$locale]/translation[@value='{@template:i18n}']/text()"/>
1.34 + <axsl:variable name="translation-default"
1.35 + select="$translations/translations/locale[1]/translation[@value='{@template:i18n}']/text()"/>
1.36 <xsl:call-template name="insert-translated-value"/>
1.37 </xsl:otherwise>
1.38 </xsl:choose>
1.39 @@ -297,6 +303,10 @@
1.40 <axsl:when test="$translation">
1.41 <axsl:value-of select="$translation"/>
1.42 </axsl:when>
1.43 + <!-- Or insert the default translated value. -->
1.44 + <axsl:when test="$translation-default">
1.45 + <axsl:value-of select="$translation-default"/>
1.46 + </axsl:when>
1.47 <!-- Otherwise, just process the descendants. -->
1.48 <axsl:otherwise>
1.49 <xsl:choose>