From: Jirka Kosek <jirka@kosek.cz> Date: Tue, 20 Jul 2010 15:08:18 +0000 (+0000) Subject: Another small speed improvement X-Git-Tag: release/1.79.1~6^2~875 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=857d77a09aeed2dd7b8fc61aaa582e55f116e84a;p=docbook-dsssl Another small speed improvement --- diff --git a/xsl/common/l10n.xsl b/xsl/common/l10n.xsl index cadf87557..fc4275438 100644 --- a/xsl/common/l10n.xsl +++ b/xsl/common/l10n.xsl @@ -22,6 +22,8 @@ <xsl:key name="l10n-gentext" match="l:l10n/l:gentext" use="@key"/> <xsl:key name="l10n-dingbat" match="l:l10n/l:dingbat" use="@key"/> <xsl:key name="l10n-context" match="l:l10n/l:context" use="@name"/> +<xsl:key name="l10n-template" match="l:l10n/l:context/l:template[not(@style)]" use="@name"/> +<xsl:key name="l10n-template-style" match="l:l10n/l:context/l:template[@style]" use="concat(@name, '#', @style)"/> <xsl:template name="l10n.language"> <xsl:param name="target" select="."/> @@ -431,52 +433,50 @@ |$local.context.node/l:template[@name=$name and not(@style)])[1]"/> - <xsl:variable name="template.node" - select="($context.node/l:template[@name=$name - and @style - and @style=$xrefstyle] - |$context.node/l:template[@name=$name - and not(@style)])[1]"/> + <xsl:for-each select="$context.node"> + <xsl:variable name="template.node" + select="(key('l10n-template-style', concat($name, '#', $xrefstyle)) + |key('l10n-template', $name))[1]"/> - <xsl:choose> - <xsl:when test="$local.template.node/@text"> - <xsl:value-of select="$local.template.node/@text"/> - </xsl:when> - <xsl:when test="$template.node/@text"> - <xsl:value-of select="$template.node/@text"/> - </xsl:when> - <xsl:otherwise> - <xsl:choose> - <xsl:when test="contains($name, '/')"> - <xsl:call-template name="gentext.template"> - <xsl:with-param name="context" select="$context"/> - <xsl:with-param name="name" select="substring-after($name, '/')"/> - <xsl:with-param name="origname" select="$origname"/> - <xsl:with-param name="purpose" select="$purpose"/> - <xsl:with-param name="xrefstyle" select="$xrefstyle"/> - <xsl:with-param name="referrer" select="$referrer"/> - <xsl:with-param name="lang" select="$lang"/> - <xsl:with-param name="verbose" select="$verbose"/> - </xsl:call-template> - </xsl:when> - <xsl:when test="$verbose = 0"> - <!-- silence --> - </xsl:when> - <xsl:otherwise> - <xsl:message> - <xsl:text>No template for "</xsl:text> - <xsl:value-of select="$origname"/> - <xsl:text>" (or any of its leaves) exists - in the context named "</xsl:text> - <xsl:value-of select="$context"/> - <xsl:text>" in the "</xsl:text> - <xsl:value-of select="$lang"/> - <xsl:text>" localization.</xsl:text> - </xsl:message> - </xsl:otherwise> - </xsl:choose> - </xsl:otherwise> - </xsl:choose> + <xsl:choose> + <xsl:when test="$local.template.node/@text"> + <xsl:value-of select="$local.template.node/@text"/> + </xsl:when> + <xsl:when test="$template.node/@text"> + <xsl:value-of select="$template.node/@text"/> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="contains($name, '/')"> + <xsl:call-template name="gentext.template"> + <xsl:with-param name="context" select="$context"/> + <xsl:with-param name="name" select="substring-after($name, '/')"/> + <xsl:with-param name="origname" select="$origname"/> + <xsl:with-param name="purpose" select="$purpose"/> + <xsl:with-param name="xrefstyle" select="$xrefstyle"/> + <xsl:with-param name="referrer" select="$referrer"/> + <xsl:with-param name="lang" select="$lang"/> + <xsl:with-param name="verbose" select="$verbose"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$verbose = 0"> + <!-- silence --> + </xsl:when> + <xsl:otherwise> + <xsl:message> + <xsl:text>No template for "</xsl:text> + <xsl:value-of select="$origname"/> + <xsl:text>" (or any of its leaves) exists in the context named "</xsl:text> + <xsl:value-of select="$context"/> + <xsl:text>" in the "</xsl:text> + <xsl:value-of select="$lang"/> + <xsl:text>" localization.</xsl:text> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> </xsl:for-each> </xsl:template>