]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
move string-reverse function into its own file and share it.
authorAndre Malo <nd@apache.org>
Wed, 5 Feb 2014 22:47:57 +0000 (22:47 +0000)
committerAndre Malo <nd@apache.org>
Wed, 5 Feb 2014 22:47:57 +0000 (22:47 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1564972 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/style/latex/html.xsl
docs/manual/style/xsl/common.xsl
docs/manual/style/xsl/util/string-reverse.xsl [new file with mode: 0644]

index 108d470141d8d87bf91ffe61150b4910ba8e3952..943db8b8b2203e1a7a02e8a2841cca9b84dcc723 100644 (file)
@@ -25,6 +25,9 @@
                   xmlns="http://www.w3.org/1999/xhtml">
 
 
+<!-- load utility snippets -->
+<xsl:include href="../xsl/util/string-reverse.xsl" />
+
 <!-- ==================================================================== -->
 <!-- Ordinary HTML that must be converted to latex                        -->
 <!-- ==================================================================== -->
 <xsl:text>}</xsl:text>
 </xsl:template>
 
-<!-- O(log(n)) (stack usage!) string reverter -->
-<xsl:template name="string-reverse">
-<xsl:param name="string"/>
-<xsl:variable name="length" select="string-length($string)"/>
-
-<xsl:choose>
-<xsl:when test="$length &lt; 2">
-  <xsl:value-of select="$string"/>
-</xsl:when>
-<xsl:when test="$length = 2">
-  <xsl:value-of select="concat(substring($string, 2, 1), substring($string, 1, 1))"/>
-</xsl:when>
-<xsl:otherwise>
-  <xsl:variable name="middle" select="floor($length div 2)"/>
-
-  <xsl:call-template name="string-reverse">
-    <xsl:with-param name="string" select="substring($string, $middle + 1, $middle + 1)"/>
-  </xsl:call-template>
-  <xsl:call-template name="string-reverse">
-    <xsl:with-param name="string" select="substring($string, 1, $middle)"/>
-  </xsl:call-template>
-</xsl:otherwise>
-</xsl:choose>
-</xsl:template>
 
 <!-- Value-of used here explicitly because we don't wan't latex-escaping
 performed.  Of course, this will conflict with html where some tags are
index f56b0c30aeb7c14c4db11bcce7901e0d8bc7b197..dc1193bcbabd7bc83e0be38a1ae648988e4d0ef5 100644 (file)
@@ -67,6 +67,7 @@
 
 <!-- load utility snippets -->
 <xsl:include href="util/modtrans.xsl" />
+<xsl:include href="util/string-reverse.xsl" />
 
 <!-- make sure, we set relative anchors only, if we're actually -->
 <!-- transforming a modulefile (see <directive> template)       -->
@@ -604,31 +605,6 @@ if (typeof(prettyPrint) !== 'undefined') {
 <!-- /section/section/section/section -->
 
 
-<!-- O(log(n)) (stack usage!) string reverter -->
-<xsl:template name="string-reverse">
-<xsl:param name="string"/>
-<xsl:variable name="length" select="string-length($string)"/>
-
-<xsl:choose>
-<xsl:when test="$length &lt; 2">
-  <xsl:value-of select="$string"/>
-</xsl:when>
-<xsl:when test="$length = 2">
-  <xsl:value-of select="concat(substring($string, 2, 1), substring($string, 1, 1))"/>
-</xsl:when>
-<xsl:otherwise>
-  <xsl:variable name="middle" select="floor($length div 2)"/>
-
-  <xsl:call-template name="string-reverse">
-    <xsl:with-param name="string" select="substring($string, $middle + 1, $middle + 1)"/>
-  </xsl:call-template>
-  <xsl:call-template name="string-reverse">
-    <xsl:with-param name="string" select="substring($string, 1, $middle)"/>
-  </xsl:call-template>
-</xsl:otherwise>
-</xsl:choose>
-</xsl:template>
-
 <!-- strip empty lines at the beginning -->
 <xsl:template name="pre-ltrim">
 <xsl:param name="string" />
diff --git a/docs/manual/style/xsl/util/string-reverse.xsl b/docs/manual/style/xsl/util/string-reverse.xsl
new file mode 100644 (file)
index 0000000..4d560ad
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<xsl:stylesheet version="1.0"
+              xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<!-- O(log(n)) (stack usage!) string reverter -->
+<xsl:template name="string-reverse">
+<xsl:param name="string"/>
+<xsl:variable name="length" select="string-length($string)"/>
+
+<xsl:choose>
+<xsl:when test="$length &lt; 2">
+  <xsl:value-of select="$string"/>
+</xsl:when>
+<xsl:when test="$length = 2">
+  <xsl:value-of select="concat(substring($string, 2, 1), substring($string, 1, 1))"/>
+</xsl:when>
+<xsl:otherwise>
+  <xsl:variable name="middle" select="floor($length div 2)"/>
+
+  <xsl:call-template name="string-reverse">
+    <xsl:with-param name="string" select="substring($string, $middle + 1, $middle + 1)"/>
+  </xsl:call-template>
+  <xsl:call-template name="string-reverse">
+    <xsl:with-param name="string" select="substring($string, 1, $middle)"/>
+  </xsl:call-template>
+</xsl:otherwise>
+</xsl:choose>
+</xsl:template>
+<!-- /string-reverse -->
+
+</xsl:stylesheet>