]> granicus.if.org Git - docbook-dsssl/commitdiff
Updates: some to do with reorganizing the structure of this tree, some to do with...
authorNorman Walsh <ndw@nwalsh.com>
Sat, 23 Apr 2005 21:36:35 +0000 (21:36 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sat, 23 Apr 2005 21:36:35 +0000 (21:36 +0000)
docbook/relaxng/tools/augment.xsl
docbook/relaxng/tools/doc2dtd-tables.xsl
docbook/relaxng/tools/doc2dtd.xsl
docbook/relaxng/tools/include.xsl
docbook/relaxng/tools/runtests
docbook/relaxng/tools/slides-upgrade.xsl
docbook/relaxng/tools/trimgrammar.pl
docbook/relaxng/tools/xml2dtd.xsl

index d92a44d8312ee6599e6b4f6cbda2de1956ed8000..f2301d6bdb8d941864d0df8a49c34cbbad811a9c 100644 (file)
@@ -4,7 +4,7 @@
                 xmlns:rng="http://relaxng.org/ns/structure/1.0"
                 xmlns:ctrl="http://nwalsh.com/xmlns/schema-control/"
                xmlns:s="http://www.ascc.net/xml/schematron"
-               xmlns:db="http://docbook.org/docbook-ng"
+               xmlns:db="http://docbook.org/ns/docbook"
                xmlns:dbx = "http://sourceforge.net/projects/docbook/defguide/schema/extra-markup"
                 exclude-result-prefixes="exsl ctrl"
                 version="1.0">
@@ -35,7 +35,7 @@
   <xsl:template match="rng:grammar" priority="2">
     <grammar xmlns="http://relaxng.org/ns/structure/1.0"
             xmlns:s="http://www.ascc.net/xml/schematron"
-            xmlns:db="http://docbook.org/docbook-ng"
+            xmlns:db="http://docbook.org/ns/docbook"
             xmlns:dbx = "http://sourceforge.net/projects/docbook/defguide/schema/extra-markup">
 
       <!-- Make sure the datatypeLibrary is specified -->
@@ -45,7 +45,7 @@
 
       <!-- Make sure the ns is specified -->
       <xsl:attribute name="ns">
-       <xsl:value-of select="'http://docbook.org/docbook-ng'"/>
+       <xsl:value-of select="'http://docbook.org/ns/docbook'"/>
       </xsl:attribute>
 
       <xsl:copy-of select="@*"/>
@@ -54,7 +54,7 @@
       <xsl:text>&#10;</xsl:text>
       <xsl:comment> DocBook NG: The "KahlĂșa" Release </xsl:comment>
       <xsl:text>&#10;</xsl:text>
-      <xsl:comment> See http://docbook.org/docbook-ng/ </xsl:comment>
+      <xsl:comment> See http://docbook.org/ns/docbook </xsl:comment>
       <xsl:text>&#10;</xsl:text>
 
       <xsl:apply-templates/>
index 969ab2dcb337baa930b8be51364e254bef5a7fa7..2344c2faec0ee9a5624334b6f996126c1b187a8a 100644 (file)
   </dtd:element>
 </xsl:variable>
 
+<xsl:variable name="merged-caption">
+  <dtd:element name="caption">
+    <dtd:group>
+      <dtd:choice repeat="*">
+       <dtd:PCDATA/>
+        <dtd:ref name="itemizedlist"/>
+        <dtd:ref name="orderedlist"/>
+        <dtd:ref name="procedure"/>
+        <dtd:ref name="simplelist"/>
+        <dtd:ref name="variablelist"/>
+        <dtd:ref name="segmentedlist"/>
+        <dtd:ref name="glosslist"/>
+        <dtd:ref name="bibliolist"/>
+        <dtd:ref name="calloutlist"/>
+        <dtd:ref name="qandaset"/>
+        <dtd:ref name="caution"/>
+        <dtd:ref name="important"/>
+        <dtd:ref name="note"/>
+        <dtd:ref name="tip"/>
+        <dtd:ref name="warning"/>
+        <dtd:ref name="example"/>
+        <dtd:ref name="figure"/>
+        <dtd:ref name="table"/>
+        <dtd:ref name="informalexample"/>
+        <dtd:ref name="informalfigure"/>
+        <dtd:ref name="informaltable"/>
+        <dtd:ref name="sidebar"/>
+        <dtd:ref name="blockquote"/>
+        <dtd:ref name="address"/>
+        <dtd:ref name="epigraph"/>
+        <dtd:ref name="mediaobject"/>
+        <dtd:ref name="screenshot"/>
+        <dtd:ref name="task"/>
+        <dtd:ref name="productionset"/>
+        <dtd:ref name="constraintdef"/>
+        <dtd:ref name="msgset"/>
+        <dtd:ref name="programlisting"/>
+        <dtd:ref name="screen"/>
+        <dtd:ref name="literallayout"/>
+        <dtd:ref name="synopsis"/>
+        <dtd:ref name="programlistingco"/>
+        <dtd:ref name="screenco"/>
+        <dtd:ref name="cmdsynopsis"/>
+        <dtd:ref name="funcsynopsis"/>
+        <dtd:ref name="classsynopsis"/>
+        <dtd:ref name="methodsynopsis"/>
+        <dtd:ref name="constructorsynopsis"/>
+        <dtd:ref name="destructorsynopsis"/>
+        <dtd:ref name="fieldsynopsis"/>
+        <dtd:ref name="bridgehead"/>
+        <dtd:ref name="remark"/>
+        <dtd:ref name="revhistory"/>
+        <dtd:ref name="indexterm"/>
+        <dtd:ref name="equation"/>
+        <dtd:ref name="informalequation"/>
+        <dtd:ref name="anchor"/>
+        <dtd:ref name="para"/>
+        <dtd:ref name="formalpara"/>
+        <dtd:ref name="simpara"/>
+        <dtd:ref name="html:form"/>
+        <dtd:ref name="annotation"/>
+      </dtd:choice>
+    </dtd:group>
+  </dtd:element>
+</xsl:variable>
+
 </xsl:stylesheet>
 
index 9b86f947070a1305534cf4c9c4202e9a8ee9f78c..bcc6279f873080ead3443ef700bb6d1f70918767 100644 (file)
 
     <!-- Handle the thead patterns -->
 
+    <!-- Note: the extra testing in here for not(@name='xml:id') is necessary
+         because the attribute generation code uses the presence of xml:id
+        to decide if common attributes should be output, so it mustn't appear
+        twice. -->
+
     <xsl:when test="@name = 'db.cals.thead' and key('pattern', 'db.html.thead')">
       <xsl:variable name="html.thead"
                    select="key('pattern', 'db.html.thead')"/>
@@ -84,7 +89,7 @@
       <dtd:attlist name="thead">
        <xsl:apply-templates select="rng:element/doc:attributes"
                             mode="attributes"/>
-       <xsl:apply-templates select="$html.thead/rng:element/doc:attributes"
+       <xsl:apply-templates select="$html.thead/rng:element/doc:attributes//rng:attribute[not(@name='xml:id')]"
                             mode="attributes"/>
       </dtd:attlist>
     </xsl:when>
       <dtd:attlist name="tfoot">
        <xsl:apply-templates select="rng:element/doc:attributes"
                             mode="attributes"/>
-       <xsl:apply-templates select="$html.tfoot/rng:element/doc:attributes"
+       <xsl:apply-templates select="$html.tfoot/rng:element/doc:attributes//rng:attribute[not(@name='xml:id')]"
                             mode="attributes"/>
       </dtd:attlist>
     </xsl:when>
       <dtd:attlist name="tbody">
        <xsl:apply-templates select="rng:element/doc:attributes"
                             mode="attributes"/>
-       <xsl:apply-templates select="$html.tbody/rng:element/doc:attributes"
+       <xsl:apply-templates select="$html.tbody/rng:element/doc:attributes//rng:attribute[not(@name='xml:id')]"
                             mode="attributes"/>
       </dtd:attlist>
     </xsl:when>
       <dtd:attlist name="informaltable">
        <xsl:apply-templates select="rng:element/doc:attributes"
                             mode="attributes"/>
-       <xsl:apply-templates select="$html.informaltable/rng:element/doc:attributes"
+       <xsl:apply-templates select="$html.informaltable/rng:element/doc:attributes//rng:attribute[not(@name='xml:id')]"
                             mode="attributes"/>
       </dtd:attlist>
     </xsl:when>
       <dtd:attlist name="table">
        <xsl:apply-templates select="rng:element/doc:attributes"
                             mode="attributes"/>
-       <xsl:apply-templates select="$html.table/rng:element/doc:attributes"
+       <xsl:apply-templates select="$html.table/rng:element/doc:attributes//rng:attribute[not(@name='xml:id')]"
                             mode="attributes"/>
       </dtd:attlist>
     </xsl:when>
       <!-- nop; handled by the db.cals.table branch -->
     </xsl:when>
 
+    <xsl:when test="@name = 'db.caption' and key('pattern', 'db.html.caption')">
+      <xsl:variable name="html.caption"
+                   select="key('pattern', 'db.html.caption')"/>
+
+      <xsl:copy-of select="$merged-caption"/>
+
+      <dtd:attlist name="caption">
+       <xsl:apply-templates select="rng:element/doc:attributes"
+                            mode="attributes"/>
+       <xsl:apply-templates select="$html.caption/rng:element/doc:attributes//rng:attribute[not(@name='xml:id')]"
+                            mode="attributes"/>
+      </dtd:attlist>
+    </xsl:when>
+
+    <xsl:when test="@name = 'db.html.caption'
+                   and key('pattern', 'db.caption')">
+      <!-- nop; handled by the db.caption branch -->
+    </xsl:when>
+
     <xsl:otherwise>
       <xsl:apply-templates/>
     </xsl:otherwise>
        <xsl:when test="@name = 'userlevel'"/>
        <xsl:when test="@name = 'vendor'"/>
        <xsl:when test="@name = 'wordsize'"/>
+       <xsl:when test="@name = 'annotations'"/>
 
        <xsl:when test="@name = 'linkend'">
          <dtd:peref name="db.common.linking.attributes"/>
index d68930772780a72757fa8ed890830835720ea267..dfd8e1952829ebebe15f041f0035e4737b0c5258 100644 (file)
@@ -11,6 +11,9 @@
 
   <xsl:key name="defs" match="rng:define" use="@name"/>
   <xsl:key name="combines" match="rng:define[@combine='choice']" use="@name"/>
+  <xsl:key name="interleaves"
+          match="rng:define[@combine='interleave']"
+          use="@name"/>
   <xsl:key name="overrides" match="rng:define[@override]" use="@name"/>
 
   <xsl:template match="/">
   <xsl:template match="rng:define" mode="combine">
     <xsl:choose>
       <xsl:when test="@combine = 'choice'"/>
-      <xsl:when test="@combine = 'interleave'">
-       <!-- these are always attributes, right? -->
-       <xsl:message>
-         <xsl:text>Interleaving attributes for </xsl:text>
-         <xsl:value-of select="@name"/>
-       </xsl:message>
-
-       <xsl:copy>
-         <xsl:copy-of select="@*"/>
-         <xsl:apply-templates mode="combine"/>
-       </xsl:copy>
-      </xsl:when>
+      <xsl:when test="@combine = 'interleave'"/>
       <xsl:when test="@combine">
        <!-- what's this!? -->
        <xsl:message>
          <xsl:apply-templates mode="combine"/>
        </xsl:copy>
       </xsl:when>
+
       <xsl:otherwise>
        <xsl:variable name="choices" select="key('combines', @name)"/>
+       <xsl:variable name="ileaves" select="key('interleaves', @name)"/>
        <xsl:choose>
+         <xsl:when test="$choices and $ileaves">
+           <xsl:message>
+             <xsl:text>Warning: choice and interleave for </xsl:text>
+             <xsl:value-of select="@name"/>
+           </xsl:message>
+         </xsl:when>
+         <xsl:when test="$ileaves">
+           <!-- these are always attributes, right? -->
+           <xsl:message>
+             <xsl:text>Interleaving definitions for </xsl:text>
+             <xsl:value-of select="@name"/>
+           </xsl:message>
+
+           <xsl:if test="not(rng:interleave) or count(*) &gt; 1">
+             <xsl:message>
+               <xsl:text>Unexpected content for </xsl:text>
+               <xsl:value-of select="@name"/>
+             </xsl:message>
+           </xsl:if>
+
+           <xsl:copy>
+             <xsl:copy-of select="@*"/>
+             <rng:interleave>
+               <xsl:apply-templates select="rng:interleave/*" mode="combine"/>
+               <xsl:apply-templates select="$ileaves/*" mode="combine"/>
+             </rng:interleave>
+           </xsl:copy>
+         </xsl:when>
          <xsl:when test="$choices">
            <xsl:message>
              <xsl:text>Combining definitions for </xsl:text>
index 7fa3649e2fbadf1756544e2abed87f41c73cb9b9..ba60865d69379eed24c56fe06faef9c4b3cd9f97 100755 (executable)
@@ -4,7 +4,7 @@
 
 XMLFILES=$@
 SRCDIR=/sourceforge/docbook/testdocs/tests
-DB4UPG=../tools/db4-upgrade.xsl
+DB4UPG=../../tools/db4-upgrade.xsl
 
 if [ ! -d passed ]; then
     echo "Directory 'passed' must exist. Are you sure you're in the right place?"
index 4e17f4e58bd736ea0311b7e18d7072f5ca1f7008..37900eec38e53a0da40b0049e9efac0b201a181b 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:exsl="http://exslt.org/common"
-               xmlns:db = "http://docbook.org/docbook-ng"
+               xmlns:db = "http://docbook.org/ns/docbook"
                 exclude-result-prefixes="exsl db"
                 version="1.0">
 
index 30284d92b466f497b9af4794a734b48f6a50e8c1..a97e03288ecea27a03e9ad94e41557ad8554b874 100644 (file)
@@ -36,7 +36,9 @@ print STDERR "There are $#pats patterns in $xmlfile.\n";
 
 my %used = ();
 
-recurse($start ,1);
+foreach my $pat (@{$start}) {
+    recurse($pat ,1);
+}
 
 @pats = keys %used;
 my $usedPat = $#pats + 1;
@@ -70,9 +72,15 @@ sub findPatterns {
     while ($child) {
        if ($child->getNodeType() == XML::DOM::ELEMENT_NODE) {
            if ($child->getTagName() eq 'define') {
-               $patterns{$child->getAttribute('name')} = $child;
+               my $name = $child->getAttribute('name');
+#              print "PAT $name\n";
+               $patterns{$name} = [] if ! exists $patterns{$name};
+               push(@{$patterns{$name}}, $child);
            } elsif ($child->getTagName() eq 'start') {
-               $patterns{"*start"} = $child;
+               my $name = "*start";
+#              print "PAT $name\n";
+               $patterns{$name} = [] if ! exists $patterns{$name};
+               push(@{$patterns{$name}}, $child);
            } elsif ($child->getTagName() eq 'div') {
                findPatterns($child);
            }
@@ -88,7 +96,9 @@ sub recurse {
     my $child = $node->getFirstChild();
 
 #    print "X", " " x $depth, $node->getTagName();
-#    print " (", $node->getAttribute('name'), ")\n";
+#    print " (", $node->getAttribute('name'), ")";
+#    print " has children" if $child;
+#    print "\n";
 
     while ($child) {
        if ($child->getNodeType() == XML::DOM::ELEMENT_NODE) {
@@ -98,7 +108,9 @@ sub recurse {
                    $used{$name} = 1;
                    print "D", " " x $depth, $name, "\n" if $showRecurse;
                    die "No pattern for $name\n" if ! exists $patterns{$name};
-                   recurse($patterns{$name},$depth+1);
+                   foreach my $pat (@{$patterns{$name}}) {
+                       recurse($pat,$depth+1);
+                   }
                }
            } elsif ($child->getTagName() eq 'ref') {
                my $name = $child->getAttribute('name');
@@ -106,10 +118,12 @@ sub recurse {
                    $used{$name} = 1;
                    print "R", " " x $depth, $name, "\n" if $showRecurse;
                    die "No pattern for $name\n" if ! exists $patterns{$name};
-                   recurse($patterns{$name},$depth+1);
+                   foreach my $pat (@{$patterns{$name}}) {
+                       recurse($pat,$depth+1);
+                   }
                }
            } else {
-               recurse($child, $depth);
+               recurse($child, $depth+1);
            }
        }
 
index 539970892b8ba313349a3ac74fad84d4cba26220..62b7497fab378426a1663999cc6d07cdafab6437 100644 (file)
@@ -9,7 +9,7 @@
 
 <xsl:strip-space elements="*"/>
 
-<xsl:param name="ns" select="'http://docbook.org/docbook-ng'"/>
+<xsl:param name="ns" select="'http://docbook.org/ns/docbook'"/>
 
 <xsl:template match="/">
   <xsl:apply-templates/>