[PATCH xorg-docs 2/2] Replace XMLTO with XSLTPROC, XMLLINT and W3M tools

Gaetan Nadon memsize at videotron.ca
Tue Mar 22 07:19:46 PDT 2011


Xmlto is a script that selects the appropriate back-end
based on options and tools availability.

Xmlto uses an xsl "fragment" which is not compatible with
the standard use of xsl stylesheets. The customization for
xhtml and fo cannot be used with xsltproc in that context.
It makes adoption of docbook features like olink and profiling
significantly more difficult.

The tools that xmlto invokes will be called directly by the makefile,
which are xmllint for validation, xsltproc, and w3m for text format.

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 .gitignore                |    1 +
 configure.ac              |    6 ++-
 docbook.am                |  106 ++++++++++++++++++++++++---------------------
 specs/Xserver/Makefile.am |    4 +-
 4 files changed, 63 insertions(+), 54 deletions(-)

diff --git a/.gitignore b/.gitignore
index 04042e4..3097848 100644
--- a/.gitignore
+++ b/.gitignore
@@ -81,3 +81,4 @@ core
 *.pdf
 *.txt
 *.db
+*.fo
diff --git a/configure.ac b/configure.ac
index 615d31a..23e505a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,10 +39,12 @@ XORG_MACROS_VERSION(1.12)
 XORG_DEFAULT_OPTIONS
 XORG_ENABLE_DOCS
 XORG_ENABLE_SPECS
-XORG_WITH_XMLTO(0.0.22)
+XORG_CHECK_SGML_DOCTOOLS(1.5)
+XORG_WITH_XMLTO
 XORG_WITH_XSLTPROC
+XORG_WITH_XMLLINT
 XORG_WITH_FOP
-XORG_CHECK_SGML_DOCTOOLS(1.5)
+XORG_WITH_W3M
 
 AC_CONFIG_FILES([Makefile
 		 general/Makefile
diff --git a/docbook.am b/docbook.am
index 10d0053..edefe36 100644
--- a/docbook.am
+++ b/docbook.am
@@ -20,76 +20,84 @@ shelf_DATA =
 # DocBook/XML file with chapters, appendix and images it includes
 dist_shelf_DATA = $(docbook) $(chapters)
 
-#
-# Generate DocBook/XML output formats with or without stylesheets
-#
-
-# Stylesheets are available if the package xorg-sgml-doctools is installed
+if HAVE_XSLTPROC
 if HAVE_STYLESHEETS
 
-# The location where all cross reference databases are installed
-sgmldbsdir = $(XORG_SGML_PATH)/X11/dbs
-masterdb = "$(sgmldbsdir)/masterdb$(suffix $@).xml"
-XMLTO_FLAGS =							\
-	--searchpath "$(XORG_SGML_PATH)/X11"			\
-	--stringparam target.database.document=$(masterdb)	\
-	--stringparam current.docid="$(<:.xml=)"		\
-	--stringparam collect.xref.targets="no"
-
-XMLTO_XHTML_FLAGS = \
-	-m $(STYLESHEET_SRCDIR)/xorg-xhtml.xsl \
-	--stringparam html.stylesheet=$(STYLESHEET_SRCDIR)/xorg.css
-
-XMLTO_FO_FLAGS = \
-	-m $(STYLESHEET_SRCDIR)/xorg-fo.xsl
-endif HAVE_STYLESHEETS
-
-shelf_DATA += $(docbook:.xml=.html)
-%.html: %.xml  $(chapters)
-	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_XHTML_FLAGS) xhtml-nochunks $<
-
-if HAVE_FOP
-shelf_DATA += $(docbook:.xml=.pdf) $(docbook:.xml=.ps)
-%.pdf: %.xml $(chapters)
-	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_FO_FLAGS) --with-fop pdf $<
-%.ps: %.xml $(chapters)
-	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_FO_FLAGS) --with-fop ps $<
-endif HAVE_FOP
-
-if HAVE_XMLTO_TEXT
-shelf_DATA += $(docbook:.xml=.txt)
-%.txt: %.xml $(chapters)
-	$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) $(XMLTO_XHTML_FLAGS) txt $<
-endif HAVE_XMLTO_TEXT
+if HAVE_XMLLINT
+XMLLINT_FLAGS = --noout --nonet --xinclude --postvalid --noent
+endif HAVE_XMLLINT
 
 #
-# Generate documents cross-reference target databases
+# Generate DocBook/XML document cross-reference database
 #
 
-# This is only possible if the xorg-sgml-doctools package is installed
-if HAVE_STYLESHEETS
-if HAVE_XSLTPROC
+# The location where all cross reference databases are installed
+sgmldbsdir = $(XORG_SGML_PATH)/X11/dbs
 
 # DocBook/XML generated document cross-reference database
 sgmldbs_DATA = $(docbook:.xml=.html.db) $(docbook:.xml=.fo.db)
 
-# Generate DocBook/XML document cross-reference database
 # Flags for the XSL Transformation processor generating xref target databases
-XSLTPROC_FLAGS =					\
+XSLTPROC_DB_FLAGS =					\
 	--path "$(XORG_SGML_PATH)/X11"			\
 	--stringparam targets.filename "$@"		\
 	--stringparam collect.xref.targets "only"	\
 	--nonet --xinclude
 
 %.html.db: %.xml  $(chapters)
-	$(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) \
+	$(AM_V_at)$(XMLLINT) $(XMLLINT_FLAGS) $<
+	$(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_DB_FLAGS) \
 	http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl $<
 
 %.fo.db: %.xml $(chapters)
-	$(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) \
+	$(AM_V_at)$(XMLLINT) $(XMLLINT_FLAGS) $<
+	$(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_DB_FLAGS) \
 	http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl $<
 
-endif HAVE_XSLTPROC
+#
+# Generate DocBook/XML output formats (html/ps/pdf/txt)
+#
+
+masterdb = "$(sgmldbsdir)/masterdb$(suffix $@).xml"
+XSLTPROC_FLAGS =						\
+	-o $@							\
+	--path "$(XORG_SGML_PATH)/X11"				\
+	--stringparam target.database.document $(masterdb)	\
+	--stringparam current.docid "$(<:.xml=)"		\
+	--stringparam collect.xref.targets "no"			\
+	--nonet							\
+	--xinclude
+XSLTPROC_XHTML_FLAGS = \
+	--stringparam html.stylesheet "$(STYLESHEET_SRCDIR)/xorg.css" \
+	"$(STYLESHEET_SRCDIR)/xorg-xhtml.xsl"
+XSLTPROC_FO_FLAGS = \
+	"$(STYLESHEET_SRCDIR)/xorg-fo.xsl"
+
+shelf_DATA += $(docbook:.xml=.html)
+%.html: %.xml  $(chapters)
+	$(AM_V_at)$(XMLLINT) $(XMLLINT_FLAGS) $<
+	$(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) $(XSLTPROC_XHTML_FLAGS) $<
+
+if HAVE_FOP
+shelf_DATA += $(docbook:.xml=.pdf) $(docbook:.xml=.ps)
+nodist_noinst_DATA = $(docbook:.xml=.fo)
+%.fo: %.xml $(chapters)
+	$(AM_V_at)$(XMLLINT) $(XMLLINT_FLAGS) $< >$@
+	$(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) $(XSLTPROC_FO_FLAGS) $<
+%.pdf: %.fo
+	$(AM_V_GEN)$(FOP) $(FOP_FLAGS) $(FOP_FLAGS) -fo $< -pdf $@
+%.ps: %.fo
+	$(AM_V_GEN)$(FOP) $(FOP_FLAGS) $(FOP_FLAGS) -fo $< -ps $@
+endif HAVE_FOP
+
+if HAVE_W3M
+W3M_FLAGS = -T text/html -dump -cols 70
+shelf_DATA += $(docbook:.xml=.txt)
+%.txt: %.html
+	$(AM_V_GEN)$(W3M) $(W3M_FLAGS) $< >$@
+endif HAVE_W3M
+
 endif HAVE_STYLESHEETS
+endif HAVE_XSLTPROC
 
-CLEANFILES = $(shelf_DATA) $(sgmldbs_DATA)
+CLEANFILES = $(shelf_DATA) $(nodist_noinst_DATA) $(sgmldbs_DATA)
diff --git a/specs/Xserver/Makefile.am b/specs/Xserver/Makefile.am
index 71d486f..294b715 100644
--- a/specs/Xserver/Makefile.am
+++ b/specs/Xserver/Makefile.am
@@ -1,6 +1,5 @@
 
 if ENABLE_SPECS
-if HAVE_XMLTO
 
 # Main DocBook/XML files (DOCTYPE book)
 docbook = analysis.xml appgroup.xml secint.xml XACE-Spec.xml
@@ -8,8 +7,7 @@ docbook = analysis.xml appgroup.xml secint.xml XACE-Spec.xml
 # The location where the DocBook/XML files and their generated formats are installed
 shelfdir = $(docdir)/Xserver
 
-# Generate DocBook/XML output formats with or without stylesheets
+# Generate DocBook/XML output formats
 include $(top_srcdir)/docbook.am
 
-endif HAVE_XMLTO
 endif ENABLE_SPECS
-- 
1.6.0.4



More information about the xorg-devel mailing list