]> granicus.if.org Git - docbook-dsssl/commitdiff
Support MathML and chunking properly
authorNorman Walsh <ndw@nwalsh.com>
Tue, 3 Apr 2001 12:11:20 +0000 (12:11 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Tue, 3 Apr 2001 12:11:20 +0000 (12:11 +0000)
xsl/xhtml/chunk.xsl [new file with mode: 0644]
xsl/xhtml/docbook.xsl
xsl/xhtml/xtchunk.xsl

diff --git a/xsl/xhtml/chunk.xsl b/xsl/xhtml/chunk.xsl
new file mode 100644 (file)
index 0000000..9b23ffb
--- /dev/null
@@ -0,0 +1,20 @@
+<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>
index 31a5562914fc3272ea87285d3b3d57fec16a50e0..63c77e3340a386c5308bb8796da591462174dc96 100644 (file)
@@ -1,5 +1,6 @@
 <?xml version='1.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 has to be last because of document order nonsense -->
 <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>
index f1ca18d66d328e63d046bb5b478b467565889656..a136cdb50d0f2610fcac1cf1ba67f9a8aee207d9 100644 (file)
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:xt="http://www.jclark.com/xt"
-               version="1.0"
-                extension-element-prefixes="xt">
+                xmlns:mml="http://www.w3.org/1998/Math/MathML"
+               version="1.0">
 
-<!-- NB: because xt:document doesn't seem to accept an AVT in its -->
-<!-- method attribute, some code has to be duplicated here. Check -->
-<!-- to make sure this code is in sync with ../html/xtchunk.xsl   -->
-<!-- if you're having difficulties :-(                            -->
+<xsl:import href="../html/xtchunk.xsl"/>
 
-<xsl:include href="../html/xtchunk.xsl"/>
-
-<xsl:variable name="html.ext">.xhtm</xsl:variable>
+<xsl:param name="html.ext" select="'.xhtm'"/>
 
 <xsl:output method="xml"/>
 
-<xsl:template match="set|book|part|preface|chapter|appendix
-                     |article
-                     |reference|refentry
-                     |sect1[position()>1]
-                     |section[position()>1 and name(parent::*) != 'section']
-                     |setindex
-                     |book/glossary|article/glossary
-                     |book/bibliography|article/bibliography
-                     |book/index|article/index
-                     |colophon">
-  <xsl:variable name="prev"
-    select="(preceding::book[1]
-             |preceding::preface[1]
-             |preceding::chapter[1]
-             |preceding::appendix[1]
-             |preceding::part[1]
-             |preceding::reference[1]
-             |preceding::refentry[1]
-             |preceding::colophon[1]
-             |preceding::sect1[position()=1
-                               and name(preceding-sibling::*[1]) = 'sect1']
-             |preceding::section[position()=1
-                                 and name(preceding-sibling::*[1]) = 'section'
-                                 and name(parent::*) != 'section']
-             |preceding::article[1]
-             |preceding::bibliography[1]
-             |preceding::glossary[1]
-             |preceding::index[1]
-             |preceding::setindex[1]
-             |ancestor::set
-             |ancestor::book[1]
-             |ancestor::preface[1]
-             |ancestor::chapter[1]
-             |ancestor::appendix[1]
-             |ancestor::part[1]
-             |ancestor::reference[1]
-             |ancestor::article[1])[last()]"/>
-
-  <xsl:variable name="next"
-    select="(following::book[1]
-             |following::preface[1]
-             |following::chapter[1]
-             |following::appendix[1]
-             |following::part[1]
-             |following::reference[1]
-             |following::refentry[1]
-             |following::colophon[1]
-             |following::sect1[1]
-             |following::section[name(parent::*) != 'section']
-             |following::bibliography[1]
-             |following::glossary[1]
-             |following::index[1]
-             |following::article[1]
-             |following::setindex[1]
-             |descendant::book[1]
-             |descendant::preface[1]
-             |descendant::chapter[1]
-             |descendant::appendix[1]
-             |descendant::article[1]
-             |descendant::bibliography[1]
-             |descendant::glossary[1]
-             |descendant::index[1]
-             |descendant::colophon[1]
-             |descendant::setindex[1]
-             |descendant::part[1]
-             |descendant::reference[1]
-             |descendant::refentry[1]
-             |descendant::sect1[2]
-             |descendant::section[position()=2
-                                  and name(parent::*) != 'section'])[1]"/>
-
-  <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
-  <xsl:variable name="chunkfn">
-    <xsl:if test="$ischunk='1'">
-      <xsl:apply-templates mode="chunk-filename" select="."/>
-    </xsl:if>
-  </xsl:variable>
-
-  <xsl:if test="$ischunk='0'">
-    <xsl:message>
-      <xsl:text>Error </xsl:text>
-      <xsl:value-of select="name(.)"/>
-      <xsl:text> is not a chunk!</xsl:text>
-    </xsl:message>
-  </xsl:if>
-
-  <xsl:message>
-    <xsl:text>Writing </xsl:text>
-    <xsl:value-of select="$chunkfn"/>
-    <xsl:text> for </xsl:text>
-    <xsl:value-of select="name(.)"/>
-  </xsl:message>
-
-  <xt:document method="html" href="{$chunkfn}">
-    <html>
-      <xsl:call-template name="html.head">
-        <xsl:with-param name="prev" select="$prev"/>
-        <xsl:with-param name="next" select="$next"/>
-      </xsl:call-template>
-
-      <body>
-        <xsl:call-template name="header.navigation">
-          <xsl:with-param name="prev" select="$prev"/>
-          <xsl:with-param name="next" select="$next"/>
-        </xsl:call-template>
-
-
-        <xsl:apply-imports/>
-
-        <xsl:call-template name="footer.navigation">
-          <xsl:with-param name="prev" select="$prev"/>
-          <xsl:with-param name="next" select="$next"/>
-        </xsl:call-template>
-      </body>
-    </html>
-  </xt:document>
+<xsl:template match="mml:*">
+  <xsl:element name="{name(.)}">
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates/>
+  </xsl:element>
 </xsl:template>
 
-</xsl:stylesheet>
+</xsl:stylesheet>
\ No newline at end of file