]> granicus.if.org Git - docbook-dsssl/commitdiff
Completely reworked strategy for XHTML
authorNorman Walsh <ndw@nwalsh.com>
Sun, 30 Dec 2001 22:28:26 +0000 (22:28 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sun, 30 Dec 2001 22:28:26 +0000 (22:28 +0000)
xsl/xhtml/.cvsignore [new file with mode: 0644]
xsl/xhtml/Makefile [new file with mode: 0644]
xsl/xhtml/chunk.xsl [deleted file]
xsl/xhtml/docbook.xsl [deleted file]
xsl/xhtml/html2xhtml.xsl [new file with mode: 0644]
xsl/xhtml/xslfiles.gen [new file with mode: 0644]

diff --git a/xsl/xhtml/.cvsignore b/xsl/xhtml/.cvsignore
new file mode 100644 (file)
index 0000000..1ddd38f
--- /dev/null
@@ -0,0 +1,41 @@
+admon.xsl
+autoidx.xsl
+autotoc.xsl
+biblio.xsl
+block.xsl
+calc-chunks.xsl
+callout.xsl
+changebars.xsl
+chunk-experimental.xsl
+chunk.xsl
+chunker.xsl
+component.xsl
+division.xsl
+docbook.xsl
+ebnf.xsl
+expchunk.xsl
+footnote.xsl
+formal.xsl
+glossary.xsl
+graphics.xsl
+html.xsl
+index.xsl
+info.xsl
+inline.xsl
+keywords.xsl
+lists.xsl
+math.xsl
+oldchunker.xsl
+onechunk.xsl
+param.xsl
+pi.xsl
+qandaset.xsl
+refentry.xsl
+sections.xsl
+synop.xsl
+table.xsl
+titlepage.templates.xsl
+titlepage.xsl
+toc.xsl
+verbatim.xsl
+xref.xsl
diff --git a/xsl/xhtml/Makefile b/xsl/xhtml/Makefile
new file mode 100644 (file)
index 0000000..fb02fea
--- /dev/null
@@ -0,0 +1,26 @@
+include ../../cvstools/Makefile.incl
+
+all: xslfiles
+
+include xslfiles.gen
+
+.cvsignore:
+       for f in ../html/*.xsl; do \
+           echo `basename $$f`; \
+        done >> .cvsignore
+
+# note: this will break if a file is added to the html directory that occurs
+# alphabetically after xref.xsl
+xslfiles.list: .cvsignore
+       echo -n "xslfiles: " > xslfiles.gen
+       for f in `cat .cvsignore`; do \
+           echo -n `basename $$f`; \
+            if [ "$$f" != "xref.xsl" ]; then \
+               echo " \\"; \
+            else \
+               echo ""; \
+            fi; \
+        done >> xslfiles.gen
+
+%.xsl: html2xhtml.xsl
+       $(XSLT) ../html/$@ html2xhtml.xsl $@
diff --git a/xsl/xhtml/chunk.xsl b/xsl/xhtml/chunk.xsl
deleted file mode 100644 (file)
index 9b23ffb..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:mml="http://www.w3.org/1998/Math/MathML"
-               version="1.0">
-
-<!-- This stylesheet works with Saxon and Xalan; for XT use xtchunk.xsl -->
-
-<xsl:import href="../html/chunk.xsl"/>
-
-<xsl:param name="html.ext" select="'.xhtm'"/>
-
-<xsl:output method="xml"/>
-
-<xsl:template match="mml:*">
-  <xsl:element name="{name(.)}">
-    <xsl:copy-of select="@*"/>
-    <xsl:apply-templates/>
-  </xsl:element>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/xsl/xhtml/docbook.xsl b/xsl/xhtml/docbook.xsl
deleted file mode 100644 (file)
index 17f21f2..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version='1.0'?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                version='1.0'>
-
-<!-- ********************************************************************
-     $Id$
-     ********************************************************************
-
-     This file is part of the XSL DocBook Stylesheet distribution.
-     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
-     and other information.
-
-     ******************************************************************** -->
-
-<xsl:import href="../html/docbook.xsl"/>
-
- <!-- this has to be last because of document order nonsense -->
-<xsl:output method="xml"
-            doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
-            doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
-
-<xsl:template match="*" mode="process.root">
-  <xsl:variable name="doc" select="self::*"/>
-  <html xmlns='http://www.w3.org/1999/xhtml'>
-  <head>
-    <xsl:call-template name="head.content">
-      <xsl:with-param name="node" select="$doc"/>
-    </xsl:call-template>
-    <xsl:call-template name="user.head.content">
-      <xsl:with-param name="node" select="$doc"/>
-    </xsl:call-template>
-  </head>
-  <body>
-    <xsl:call-template name="body.attributes"/>
-    <xsl:call-template name="user.header.content">
-      <xsl:with-param name="node" select="$doc"/>
-    </xsl:call-template>
-    <xsl:apply-templates select="."/>
-    <xsl:call-template name="user.footer.content">
-      <xsl:with-param name="node" select="$doc"/>
-    </xsl:call-template>
-  </body>
-  </html>
-</xsl:template>
-
-<xsl:template xmlns:mml="http://www.w3.org/1998/Math/MathML"
-              match="mml:*">
-  <xsl:element name="{name(.)}">
-    <xsl:copy-of select="@*"/>
-    <xsl:apply-templates/>
-  </xsl:element>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/xsl/xhtml/html2xhtml.xsl b/xsl/xhtml/html2xhtml.xsl
new file mode 100644 (file)
index 0000000..0f8b49f
--- /dev/null
@@ -0,0 +1,117 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+<xsl:output method="xml" encoding="US-ASCII"/>
+<xsl:preserve-space elements="*"/>
+
+<xsl:template match="/">
+  <xsl:text>&#10;</xsl:text>
+  <xsl:comment>This file was created automatically by html2xhtml</xsl:comment>
+  <xsl:text>&#10;</xsl:text>
+  <xsl:comment>from the HTML stylesheets. Do not edit this file.</xsl:comment>
+  <xsl:text>&#10;</xsl:text>
+  <xsl:apply-templates/>
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<!-- Make sure we override some templates and parameters appropriately for XHTML -->
+<xsl:template match="xsl:output">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:attribute name="method">xml</xsl:attribute>
+    <xsl:attribute name="doctype-public">-//W3C//DTD XHTML 1.0 Transitional//EN</xsl:attribute>
+    <xsl:attribute name="doctype-system">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</xsl:attribute>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="xsl:param[@name='make.valid.html']">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:attribute name="select">1</xsl:attribute>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="xsl:param[@name='output.method']">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:attribute name="select">'xml'</xsl:attribute>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="xsl:param[@name='html.ext']">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:attribute name="select">'xhtm'</xsl:attribute>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="xsl:attribute[@name='name']">
+  <xsl:choose>
+    <xsl:when test="ancestor::a">
+      <xsl:copy>
+        <xsl:copy-of select="@*"/>
+        <xsl:attribute name="name">id</xsl:attribute>
+        <xsl:apply-templates/>
+      </xsl:copy>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy>
+        <xsl:copy-of select="@*"/>
+        <xsl:apply-templates/>
+      </xsl:copy>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="xsl:template[@name='body.attributes']">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:comment> no apply-templates; make it empty </xsl:comment>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:copy>
+</xsl:template>
+
+<!-- this only occurs in docbook.xsl to identify errors -->
+<xsl:template match="font">
+  <span class="ERROR" xmlns="http://www.w3.org/1999/xhtml">
+    <xsl:apply-templates/>
+  </span>
+</xsl:template>
+
+<!-- this only occurs in docbook.xsl to identify errors -->
+<xsl:template match="a[@name]">
+  <xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1999/xhtml">
+    <xsl:attribute name="id"><xsl:value-of select="@name"/></xsl:attribute>
+    <xsl:for-each select="@*">
+      <xsl:if test="local-name(.) != 'name'">
+        <xsl:attribute name="{name(.)}"><xsl:value-of select="."/></xsl:attribute>
+      </xsl:if>
+    </xsl:for-each>
+    <xsl:apply-templates/>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template match="*">
+  <xsl:choose>
+    <xsl:when test="namespace-uri(.) = ''">
+      <xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1999/xhtml">
+        <xsl:copy-of select="@*"/>
+        <xsl:apply-templates/>
+      </xsl:element>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy>
+        <xsl:copy-of select="@*"/>
+        <xsl:apply-templates/>
+      </xsl:copy>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="comment()|processing-instruction()|text()">
+  <xsl:copy/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/xhtml/xslfiles.gen b/xsl/xhtml/xslfiles.gen
new file mode 100644 (file)
index 0000000..6e92631
--- /dev/null
@@ -0,0 +1,41 @@
+xslfiles: admon.xsl \
+autoidx.xsl \
+autotoc.xsl \
+biblio.xsl \
+block.xsl \
+calc-chunks.xsl \
+callout.xsl \
+changebars.xsl \
+chunk-experimental.xsl \
+chunk.xsl \
+chunker.xsl \
+component.xsl \
+division.xsl \
+docbook.xsl \
+ebnf.xsl \
+expchunk.xsl \
+footnote.xsl \
+formal.xsl \
+glossary.xsl \
+graphics.xsl \
+html.xsl \
+index.xsl \
+info.xsl \
+inline.xsl \
+keywords.xsl \
+lists.xsl \
+math.xsl \
+oldchunker.xsl \
+onechunk.xsl \
+param.xsl \
+pi.xsl \
+qandaset.xsl \
+refentry.xsl \
+sections.xsl \
+synop.xsl \
+table.xsl \
+titlepage.templates.xsl \
+titlepage.xsl \
+toc.xsl \
+verbatim.xsl \
+xref.xsl