]> granicus.if.org Git - docbook-dsssl/commitdiff
Finish support for @xml:id everywhere @id is used.
authorBob Stayton <bobs@sagehill.net>
Sun, 12 Nov 2006 08:23:21 +0000 (08:23 +0000)
committerBob Stayton <bobs@sagehill.net>
Sun, 12 Nov 2006 08:23:21 +0000 (08:23 +0000)
xsl/fo/autoidx.xsl
xsl/fo/biblio.xsl
xsl/fo/block.xsl
xsl/fo/callout.xsl
xsl/fo/fop.xsl
xsl/fo/index.xsl
xsl/fo/inline.xsl
xsl/fo/sections.xsl
xsl/fo/titlepage.xsl
xsl/fo/xref.xsl

index 2217a1686a502be4f3ef04788374c82552c8d31e..765cb306df1e7c4a10d6ffa5f359b4bd1e4a1dc6 100644 (file)
         <fo:page-number-citation ref-id="{$id}"/>
       </fo:basic-link>
 
-      <xsl:if test="key('endofrange', @id)[&scope;]">
-        <xsl:apply-templates select="key('endofrange', @id)[&scope;][last()]"
+      <xsl:if test="key('endofrange', $id)[&scope;]">
+        <xsl:apply-templates select="key('endofrange', $id)[&scope;][last()]"
                              mode="reference">
           <xsl:with-param name="scope" select="$scope"/>
           <xsl:with-param name="role" select="$role"/>
         </xsl:when>
         <xsl:otherwise>
           <xsl:text>&lt;phrase role="pageno"&gt;</xsl:text>
-          <xsl:if test="@id">
+          <xsl:if test="$id">
             <xsl:text>&lt;link linkend="</xsl:text>
             <xsl:value-of select="$id"/>
             <xsl:text>"&gt;</xsl:text>
           <fo:basic-link internal-destination="{$id}">
             <fo:page-number-citation ref-id="{$id}"/>
           </fo:basic-link>
-          <xsl:if test="@id">
+          <xsl:if test="$id">
             <xsl:text>&lt;/link&gt;</xsl:text>
           </xsl:if>
           <xsl:text>&lt;/phrase&gt;&#10;</xsl:text>
       </xsl:variable>
 
       <xsl:text>&lt;phrase fole="pageno"&gt;</xsl:text>
-      <xsl:if test="$target[1]/@id">
+      <xsl:if test="$target[1]/@id or $target[1]/@xml:id">
         <xsl:text>&lt;link linkend="</xsl:text>
         <xsl:value-of select="$id"/>
         <xsl:text>"&gt;</xsl:text>
       <fo:basic-link internal-destination="{$id}">
         <fo:page-number-citation ref-id="{$id}"/>
       </fo:basic-link>
-      <xsl:if test="$target[1]/@id">
+      <xsl:if test="$target[1]/@id or $target[1]/@xml:id">
         <xsl:text>&lt;/link&gt;</xsl:text>
       </xsl:if>
       <xsl:text>&lt;/phrase&gt;&#10;</xsl:text>
       </xsl:variable>
 
       <xsl:text>&lt;phrase role="pageno"&gt;</xsl:text>
-      <xsl:if test="$target[1]/@id">
+      <xsl:if test="$target[1]/@id or target[1]/@xml:id">
         <xsl:text>&lt;link linkend="</xsl:text>
         <xsl:value-of select="$id"/>
         <xsl:text>"&gt;</xsl:text>
       <fo:basic-link internal-destination="{$id}">
         <fo:page-number-citation ref-id="{$id}"/>
       </fo:basic-link>
-      <xsl:if test="$target[1]/@id">
+      <xsl:if test="$target[1]/@id or target[1]/@xml:id">
         <xsl:text>&lt;/link&gt;</xsl:text>
       </xsl:if>
       <xsl:text>&lt;/phrase&gt;&#10;</xsl:text>
index 8d7458a7fe9d8c8a47514cee49870d24074e329f..929f65df0cbe523f257d493695267932edf9a09c 100644 (file)
   <xsl:choose>
     <xsl:when test="string(.) = ''">
       <xsl:variable name="bib" select="document($bibliography.collection,.)"/>
-      <xsl:variable name="entry" select="$bib/bibliography/*[@id=$id][1]"/>
+      <xsl:variable name="entry" select="$bib/bibliography/
+                                         *[@id=$id or @xml:id=$id][1]"/>
       <xsl:choose>
         <xsl:when test="$entry">
           <xsl:choose>
   <xsl:choose>
     <xsl:when test="string(.) = ''">
       <xsl:variable name="bib" select="document($bibliography.collection,.)"/>
-      <xsl:variable name="entry" select="$bib/bibliography/*[@id=$id][1]"/>
+      <xsl:variable name="entry" select="$bib/bibliography/
+                                         *[@id=$id or @xml:id=$id][1]"/>
       <xsl:choose>
         <xsl:when test="$entry">
           <xsl:choose>
       <xsl:value-of select="$node/@xreflabel"/>
       <xsl:text>] </xsl:text>
     </xsl:when>
-    <xsl:when test="$node/@id">
+    <xsl:when test="$node/@id or $node/@xml:id">
       <xsl:text>[</xsl:text>
-      <xsl:value-of select="$node/@id"/>
+      <xsl:value-of select="($node/@id|$node/@xml:id)[1]"/>
       <xsl:text>] </xsl:text>
     </xsl:when>
     <xsl:otherwise><!-- nop --></xsl:otherwise>
index 164d49a96c4c76d875930abed738dafbf521612c..5157369d08dad65151681f379abaaf84c603691d 100644 (file)
@@ -24,9 +24,7 @@
 
 <xsl:template name="block.object">
   <fo:block>
-    <xsl:if test="@id">
-      <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="anchor"/>
     <xsl:apply-templates/>
   </fo:block>
 </xsl:template>
 
 <xsl:template match="simpara">
   <fo:block xsl:use-attribute-sets="normal.para.spacing">
-    <xsl:if test="@id">
-      <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="anchor"/>
     <xsl:apply-templates/>
   </fo:block>
 </xsl:template>
 
 <xsl:template match="formalpara">
   <fo:block xsl:use-attribute-sets="normal.para.spacing">
-    <xsl:if test="@id">
-      <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="anchor"/>
     <xsl:apply-templates/>
   </fo:block>
 </xsl:template>
 
 <xsl:template match="abstract">
   <fo:block xsl:use-attribute-sets="abstract.properties">
-    <xsl:if test="@id">
-      <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="anchor"/>
     <xsl:apply-templates/>
   </fo:block>
 </xsl:template>
 
 <xsl:template match="revhistory">
   <fo:table table-layout="fixed" xsl:use-attribute-sets="revhistory.table.properties">
-    <xsl:if test="@id">
-      <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="anchor"/>
     <fo:table-column column-number="1" column-width="proportional-column-width(1)"/>
     <fo:table-column column-number="2" column-width="proportional-column-width(1)"/>
     <fo:table-column column-number="3" column-width="proportional-column-width(1)"/>
   <fo:table-row>
     <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
       <fo:block>
-        <xsl:if test="@id">
-          <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
-        </xsl:if>
+        <xsl:call-template name="anchor"/>
         <xsl:if test="$revnumber">
           <xsl:call-template name="gentext">
             <xsl:with-param name="key" select="'Revision'"/>
 
 <xsl:template match="ackno">
   <fo:block xsl:use-attribute-sets="normal.para.spacing">
-    <xsl:if test="@id">
-      <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="anchor"/>
     <xsl:apply-templates/>
   </fo:block>
 </xsl:template>
index 17627120fd1c5ce6ee0f57535ad6a85145e15506..87746e050dcde5df16d33de538a6fa610f089ed9 100644 (file)
@@ -84,7 +84,8 @@
 </xsl:template>
 
 <xsl:template match="co">
-  <fo:inline id="{@id}">
+  <fo:inline>
+    <xsl:call-template name="anchor"/>
     <xsl:apply-templates select="." mode="callout-bug"/>
   </fo:inline>
 </xsl:template>
@@ -94,7 +95,6 @@
   <!-- "over there" as if it were "right here" -->
 
   <xsl:variable name="co" select="key('id', @linkend)"/>
-  <xsl:variable name="id" select="@id"/>
   <xsl:choose>
     <xsl:when test="not($co)">
       <xsl:message>
     </xsl:when>
     <xsl:otherwise>
       <fo:inline>
-        <xsl:if test="$id != ''">
-         <xsl:attribute name="id">
-           <xsl:value-of select="$id"/>
-         </xsl:attribute>
-       </xsl:if>
+        <xsl:call-template name="anchor"/>
         <xsl:apply-templates select="$co" mode="callout-bug"/>
       </fo:inline>
     </xsl:otherwise>
index 91c0a978017eba0dfe5deda5cb7ef7b5f6779508..c3a06bab5627cca1399a1c736b97f5b33cc10f51 100644 (file)
@@ -23,8 +23,11 @@ translates characters with code>255 back to ASCII.
 "'aaaccccddeeeeeegggghhiiiiijklllllnnnnooorrrsssstttuuuuuuwyzzzAAACCCCDDEEEEEEGGGGHHIIIIIJKLLLLLNNNNOOORRRSSSSTTTUUUUUUWYYZZZ'"/>
 
 <xsl:template match="*" mode="fop.outline">
-  <xsl:if test="@id">
-    <fox:destination internal-destination="{@id}"/>
+  <xsl:variable name="id">
+    <xsl:value-of select="(@id|@xml:id)[1]"/>
+  </xsl:variable>
+  <xsl:if test="$id != ''">
+    <fox:destination internal-destination="{$id}"/>
   </xsl:if>
   <xsl:apply-templates select="*" mode="fop.outline"/>
 </xsl:template>
index 25f9f96599ae8f4b4eff23abaf7d6d612d287bcf..e4ba84426e4455012ceeb0981d09dbc07c294d01 100644 (file)
   <xsl:choose>
     <xsl:when test="$xep.extensions != 0">
       <rx:begin-index-range>
-        <xsl:attribute name="id">
-          <xsl:value-of select="@id"/>
-        </xsl:attribute>
+        <xsl:call-template name="anchor"/>
         <xsl:attribute name="rx:key">
           <xsl:value-of select="&primary;"/>
           <xsl:if test="@significance='preferred'"><xsl:value-of select="$significant.flag"/></xsl:if>
index b1ef9bc8faa521250a4061d537076adfff98d702..ce95c5eff070516d13024d7edadffeb4db38ab37 100644 (file)
                   <xsl:text>???</xsl:text>
                 </xsl:when>
                 <xsl:otherwise>
+                  <xsl:variable name="id">
+                    <xsl:call-template name="object.id">
+                      <xsl:with-param name="object" select="$target"/>
+                    </xsl:call-template>
+                  </xsl:variable>
                   <xsl:attribute name="internal-destination">
-                    <xsl:value-of select="$target/@id"/>
+                    <xsl:value-of select="$id"/>
                   </xsl:attribute>
                 </xsl:otherwise>
               </xsl:choose>
     <xsl:apply-templates/>
   </xsl:param>
   <fo:inline font-style="italic">
-    <xsl:if test="@id">
-      <xsl:attribute name="id">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="anchor"/>
     <xsl:if test="@dir">
       <xsl:attribute name="direction">
         <xsl:choose>
     <xsl:apply-templates/>
   </xsl:param>
   <fo:inline font-weight="bold" xsl:use-attribute-sets="monospace.properties">
-    <xsl:if test="@id">
-      <xsl:attribute name="id">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="anchor"/>
     <xsl:if test="@dir">
       <xsl:attribute name="direction">
         <xsl:choose>
     <xsl:apply-templates/>
   </xsl:param>
   <fo:inline font-style="italic" xsl:use-attribute-sets="monospace.properties">
-    <xsl:if test="@id">
-      <xsl:attribute name="id">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="anchor"/>
     <xsl:if test="@dir">
       <xsl:attribute name="direction">
         <xsl:choose>
   </xsl:param>
 
   <fo:inline xsl:use-attribute-sets="superscript.properties">
-    <xsl:if test="@id">
-      <xsl:attribute name="id">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="anchor"/>
     <xsl:if test="@dir">
       <xsl:attribute name="direction">
         <xsl:choose>
   </xsl:param>
 
   <fo:inline xsl:use-attribute-sets="subscript.properties">
-    <xsl:if test="@id">
-      <xsl:attribute name="id">
-        <xsl:value-of select="@id"/>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="anchor"/>
     <xsl:if test="@dir">
       <xsl:attribute name="direction">
         <xsl:choose>
         </xsl:when>
         <xsl:otherwise>
           <xsl:variable name="id">
-            <xsl:choose>
-              <xsl:when test="$cterm/@id">
-                <xsl:value-of select="$cterm/@id"/>
-              </xsl:when>
-              <xsl:otherwise>
-                <xsl:value-of select="generate-id($cterm)"/>
-              </xsl:otherwise>
-            </xsl:choose>
+            <xsl:call-template name="object.id">
+              <xsl:with-param name="object" select="$cterm"/>
+            </xsl:call-template>
           </xsl:variable>
           <fo:basic-link internal-destination="{$id}"
                          xsl:use-attribute-sets="xref.properties">
index cd89dae5683b9e2c1176d5ea7571ce422aac3bf2..9213d2233152ce07159950d4717906b509f52567 100644 (file)
@@ -18,7 +18,7 @@
 
 <xsl:template match="section">
   <xsl:choose>
-    <xsl:when test="$rootid = @id">
+    <xsl:when test="$rootid = @id or $rootid = @xml:id">
       <xsl:call-template name="section.page.sequence"/>
     </xsl:when>
     <xsl:otherwise>
index 54127e5adbd8a26eff7a2f7d1facf4bb5091e76a..9df1d8869d2803ed3fa0fe726aa48fe38bc1df22 100644 (file)
 
 <xsl:template match="authorgroup" mode="titlepage.mode">
   <fo:wrapper>
-    <xsl:if test="@id">
-      <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="anchor"/>
     <xsl:apply-templates mode="titlepage.mode"/>
   </fo:wrapper>
 </xsl:template>
 <xsl:template match="bookinfo/authorgroup|info/authorgroup"
               mode="titlepage.mode" priority="2">
   <fo:block>
-    <xsl:if test="@id">
-      <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="anchor"/>
     <xsl:apply-templates mode="titlepage.mode"/>
   </fo:block>
 </xsl:template>
index bc61909d76cc46f910355c37d23389f13f337224..669fa6261b45ba5b3808dae272c88f8096fa6d8e 100644 (file)
 <!-- ==================================================================== -->
 
 <xsl:template match="anchor">
-  <fo:inline id="{@id}"/>
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+  <fo:inline id="{$id}"/>
 </xsl:template>
 
 <!-- ==================================================================== -->
   <xsl:choose>
     <xsl:when test="string(.) = ''">
       <xsl:variable name="bib" select="document($bibliography.collection,.)"/>
-      <xsl:variable name="id" select="@id"/>
-      <xsl:variable name="entry" select="$bib/bibliography/*[@id=$id][1]"/>
+      <xsl:variable name="id" select="(@id|@xml:id)[1]"/>
+      <xsl:variable name="entry" select="$bib/bibliography/
+                                         *[@id=$id or @xml:id=$id][1]"/>
       <xsl:choose>
         <xsl:when test="$entry">
           <xsl:choose>
               <xsl:apply-templates select="$entry/*[1]"/>
             </xsl:when>
             <xsl:otherwise>
-              <xsl:value-of select="@id"/>
+              <xsl:value-of select="(@id|@xml:id)[1]"/>
             </xsl:otherwise>
           </xsl:choose>
         </xsl:when>
             <xsl:text> found in </xsl:text>
             <xsl:value-of select="$bibliography.collection"/>
           </xsl:message>
-          <xsl:value-of select="@id"/>
+          <xsl:value-of select="(@id|@xml:id)[1]"/>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:when>
           <xsl:apply-templates select="*[1]"/>
         </xsl:when>
         <xsl:otherwise>
-          <xsl:value-of select="@id"/>
+          <xsl:value-of select="(@id|@xml:id)[1]"/>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:otherwise>
 </xsl:template>
 
 <xsl:template match="*" mode="pagenumber.markup">
-  <fo:page-number-citation ref-id="{@id}"/>
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+  <fo:page-number-citation ref-id="{$id}"/>
 </xsl:template>
 
 <!-- ==================================================================== -->