]> granicus.if.org Git - docbook-dsssl/commitdiff
Changed tangle.xweb to cause support to be added to xtangle.xsl to
authorMichael Smith <xmldoc@users.sourceforge.net>
Sun, 1 Jul 2007 16:30:27 +0000 (16:30 +0000)
committerMichael Smith <xmldoc@users.sourceforge.net>
Sun, 1 Jul 2007 16:30:27 +0000 (16:30 +0000)
suppress doctypes in xtangle.xsl output; controlled through the
suppress.doctype.in.output XSLT parameter.

litprog/Makefile
litprog/tangle.xweb

index e7e6c13211fcf9c324139dd1944b30a9d9da1c08..a5fd6cbab85c217c7f7bd326a1c2203ee980e726 100644 (file)
@@ -1,5 +1,7 @@
 include ../buildtools/Makefile.incl
 
+XTANGLE_PARAMS=
+
 all: tangle.xsl weave.xsl w2docbook.xsl xtangle.xsl
        $(MAKE) -C html
        $(MAKE) -C example
@@ -27,24 +29,24 @@ html: xml tangle.html weave.html
 # it can rebuild itself.
 xtangle.xsl: tangle.xweb bootstrap-tangle.xsl
        $(XSLT) $< bootstrap-tangle.xsl .boot.tangle.xsl
-       $(XSLT) $< .boot.tangle.xsl $@ top=xtop
+       $(XSLT) $< .boot.tangle.xsl $@ top=xtop $(XTANGLE_PARAMS)
        rm -f .boot.tangle.xsl
 
-tangle.xsl: tangle.xweb xtangle.xsl
-       $(XSLT) $< xtangle.xsl $@
+tangle.xsl: tangle.xweb xtangle.xsl 
+       $(XSLT) $< xtangle.xsl $@ $(XTANGLE_PARAMS)
 
 tangle.xml: tangle.xweb w2docbook.xsl
        $(XSLT) $< w2docbook.xsl $@
 
 weave.xsl: weave.xweb xtangle.xsl
-       $(XSLT)  $< xtangle.xsl $@
+       $(XSLT)  $< xtangle.xsl $@ $(XTANGLE_PARAMS)
 
 weave.xml: weave.xweb w2docbook.xsl
        $(XSLT)  $< w2docbook.xsl $@
        xjparse $@
 
 w2docbook.xsl: weave.xweb xtangle.xsl weave.xsl
-       $(XSLT) $< xtangle.xsl $@ top=w2docbook
+       $(XSLT) $< xtangle.xsl $@ top=w2docbook $(XTANGLE_PARAMS)
 
 realclean: clean
        rm -f xtangle.xsl
index 9775c93f5bc0db0bfba8c3d1a20dead317185b34..8bc99b8fbd27c6ddb890f568114b695de287c48b 100644 (file)
@@ -110,6 +110,7 @@ the IDs identified as type ID in the source document.</para>
   <xsl:key name="fragment" match="src:fragment" use="@*[local-name() = 'id']"/>
 
   <xsl:param name="top" select="'top'"/>
+  <xsl:param name="suppress.doctype.in.output" select="0"/>
 
 </src:fragment>
 
@@ -507,14 +508,24 @@ nodes automatically.</para>
 </orderedlist>
 
 <src:fragment id="copy-default">
-<xsl:template match="*" mode="copy">
-  <xsl:variable name="node" select="."/>
-  <xsl:element name="{name(.)}" namespace="{namespace-uri(.)}">
-    <src:fragref linkend="copy-namespaces"/>
-    <xsl:copy-of select="@*"/>
-    <xsl:apply-templates mode="copy"/>
-  </xsl:element>
-</xsl:template>
+  <xsl:template match="*" mode="copy">
+    <xsl:variable name="node" select="."/>
+    <xsl:element name="{name(.)}" namespace="{namespace-uri(.)}">
+      <src:fragref linkend="copy-namespaces"/>
+      <xsl:for-each select="@*">
+        <xsl:choose>
+          <xsl:when test="not($suppress.doctype.in.output = 0)
+          and (local-name(.) = 'doctype-public'
+          or local-name(.) = 'doctype-system')
+          "/>
+          <xsl:otherwise>
+            <xsl:copy-of select="."/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:for-each>
+      <xsl:apply-templates mode="copy"/>
+    </xsl:element>
+  </xsl:template>
 </src:fragment>
 
 <para>For non-XML source docuements, this template will never match