]> granicus.if.org Git - docbook-dsssl/commitdiff
Support coref
authorNorman Walsh <ndw@nwalsh.com>
Sat, 12 Apr 2003 21:08:37 +0000 (21:08 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sat, 12 Apr 2003 21:08:37 +0000 (21:08 +0000)
xsl/html/callout.xsl

index 2846503c7900c46fb9fa7ebe10b43ce1907c6ecd..d1e8a0cb66ed3ba8924360dd56a7ceb9ceec0dac 100644 (file)
@@ -86,7 +86,7 @@
   <xsl:number count="area|areaset" format="1"/>
 </xsl:template>
 
-<xsl:template match="co">
+<xsl:template match="co" name="co">
   <!-- Support a single linkend in HTML -->
   <xsl:variable name="targets" select="key('id', @linkends)"/>
   <xsl:variable name="target" select="$targets[1]"/>
   </xsl:choose>
 </xsl:template>
 
+<xsl:template match="coref">
+  <!-- tricky; this relies on the fact that we can process the "co" that's -->
+  <!-- "over there" as if it were "right here" -->
+
+  <xsl:variable name="co" select="key('id', @linkend)"/>
+  <xsl:choose>
+    <xsl:when test="not($co)">
+      <xsl:message>
+        <xsl:text>Error: coref link is broken: </xsl:text>
+        <xsl:value-of select="@linkend"/>
+      </xsl:message>
+    </xsl:when>
+    <xsl:when test="local-name($co) != 'co'">
+      <xsl:message>
+        <xsl:text>Error: coref doesn't point to a co: </xsl:text>
+        <xsl:value-of select="@linkend"/>
+      </xsl:message>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates select="$co"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 <xsl:template match="co" mode="callout-bug">
   <xsl:call-template name="callout-bug">
     <xsl:with-param name="conum">