]> granicus.if.org Git - docbook-dsssl/commitdiff
Add 'strippath' and 'getdir' templates that lib.xsl now requires.
authorBob Stayton <bobs@sagehill.net>
Wed, 1 Feb 2012 04:58:33 +0000 (04:58 +0000)
committerBob Stayton <bobs@sagehill.net>
Wed, 1 Feb 2012 04:58:33 +0000 (04:58 +0000)
Fixed bug 3481384 to remove extraneous "fsfunc" introduced in 1.76.1
html/synop.xsl because attribute copying was not handled correctly.

xsl/xhtml/html2xhtml.xsl

index 2d89f56ed2e044d93f122a4a97e142bbf9e436dd..6dd23e1eabb087b12d9f5360b75faacbf2c468bf 100644 (file)
   <xsl:copy/>
 </xsl:template>
 
+<xsl:template match="@*">
+  <xsl:copy-of select="."/>
+</xsl:template>
+
+<xsl:template name="strippath">
+  <xsl:param name="filename" select="''"/>
+  <xsl:choose>
+    <!-- Leading .. are not eliminated -->
+    <xsl:when test="starts-with($filename, '../')">
+      <xsl:value-of select="'../'"/>
+      <xsl:call-template name="strippath">
+        <xsl:with-param name="filename" select="substring-after($filename, '../')"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="contains($filename, '/../')">
+      <xsl:call-template name="strippath">
+        <xsl:with-param name="filename">
+          <xsl:call-template name="getdir">
+            <xsl:with-param name="filename" select="substring-before($filename, '/../')"/>
+          </xsl:call-template>
+          <xsl:value-of select="substring-after($filename, '/../')"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$filename"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="getdir">
+  <xsl:param name="filename" select="''"/>
+  <xsl:if test="contains($filename, '/')">
+    <xsl:value-of select="substring-before($filename, '/')"/>
+    <xsl:text>/</xsl:text>
+    <xsl:call-template name="getdir">
+      <xsl:with-param name="filename" select="substring-after($filename, '/')"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
 </xsl:stylesheet>