]> granicus.if.org Git - docbook-dsssl/commitdiff
An update to the fix for bug #1790495 (r7433):
authorMauritz Jeanson <mj@johanneberg.com>
Wed, 12 Sep 2007 16:05:03 +0000 (16:05 +0000)
committerMauritz Jeanson <mj@johanneberg.com>
Wed, 12 Sep 2007 16:05:03 +0000 (16:05 +0000)
The "ln-" prefix is output only when the legalnotice doesn't have an
@id/@xml:id, in which case the stylesheets generate an ID value,
resulting in a filename like "ln-7e0fwgj.html". This is useful because
without the prefix, you wouldn't know that the file contained a legalnotice.
The same logic is also applied to revhistory, using an "rh-" prefix.

xsl/html/chunk-common.xsl
xsl/html/titlepage.xsl

index f368af134b1719faf3e9b8697b1403b5225a56dd..8b0fdae9d4130114d8c01af85726b7d6e352bba3 100644 (file)
   <!-- * the following ID is used as part of the legalnotice filename; -->
   <!-- * we need it in order to construct the filename for use in the -->
   <!-- * value of the href attribute on the link -->
+
+<xsl:param name="ln-node" select="(//legalnotice)[1]"/>
+
   <xsl:param name="id">
     <xsl:call-template name="object.id">
-      <xsl:with-param name="object" select="(//legalnotice)[1]"/>
+      <xsl:with-param name="object" select="$ln-node"/>
     </xsl:call-template>
   </xsl:param>
   <xsl:param name="linktype">
               normalize-space(
               substring-after($html.head.legalnotice.link.types, ' ')),' ')"/>
   <xsl:if test="not($linktype = '')">
+
+    <!-- Use 'ln-' prefix if there is no @id/@xml:id -->
+    <xsl:variable name="file">
+      <xsl:choose>
+       <xsl:when test="$ln-node/@id or $ln-node/@xml:id">
+         <xsl:value-of select="concat($id,$html.ext)"/>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:value-of select="concat('ln-',$id,$html.ext)"/>
+       </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
     <link rel="{$linktype}">
       <xsl:attribute name="href">
-        <xsl:value-of select="concat('ln-',$id,$html.ext)"/>
+        <xsl:value-of select="$file"/>
       </xsl:attribute>
       <xsl:attribute name="title">
         <xsl:apply-templates select="(//legalnotice)[1]"
index fcaa667325ed9b8c296446354685daba5f5fcce0..7b9a8cf63e96c56911da0f6e34ee782bf8c8e199 100644 (file)
 
 <xsl:template match="legalnotice" mode="titlepage.mode">
   <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
+
+  <!-- Use 'ln-' prefix if there is no @id/@xml:id -->
+  <xsl:variable name="file">
+    <xsl:choose>
+      <xsl:when test="@id or @xml:id">
+       <xsl:value-of select="concat($id,$html.ext)"/>
+      </xsl:when>
+      <xsl:otherwise>
+       <xsl:value-of select="concat('ln-',$id,$html.ext)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
   <xsl:choose>
     <xsl:when test="$generate.legalnotice.link != 0">
       <xsl:variable name="filename">
         <xsl:call-template name="make-relative-filename">
           <xsl:with-param name="base.dir" select="$base.dir"/>
-         <xsl:with-param name="base.name" select="concat('ln-',$id,$html.ext)"/>
+         <xsl:with-param name="base.name" select="$file"/>
         </xsl:call-template>
       </xsl:variable>
 
         <xsl:apply-templates select="." mode="title.markup"/>
       </xsl:variable>
 
-      <a href="{concat('ln-',$id,$html.ext)}">
+      <a href="{$file}">
         <xsl:copy-of select="$title"/>
       </a>
 
 
   <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
 
+ <!-- Use 'rh-' prefix if there is no @id/@xml:id -->
+  <xsl:variable name="file">
+    <xsl:choose>
+      <xsl:when test="@id or @xml:id">
+       <xsl:value-of select="concat($id,$html.ext)"/>
+      </xsl:when>
+      <xsl:otherwise>
+       <xsl:value-of select="concat('rh-',$id,$html.ext)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
   <xsl:variable name="title">
     <xsl:call-template name="gentext">
       <xsl:with-param name="key">RevHistory</xsl:with-param>
       <xsl:variable name="filename">
         <xsl:call-template name="make-relative-filename">
           <xsl:with-param name="base.dir" select="$base.dir"/>
-          <xsl:with-param name="base.name" select="concat($id,$html.ext)"/>
+          <xsl:with-param name="base.name" select="$file"/>
         </xsl:call-template>
       </xsl:variable>
 
-      <a href="{concat($id,$html.ext)}">
+      <a href="{$file}">
         <xsl:copy-of select="$title"/>
       </a>