Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎专栏 | Search | Email

2.2. XML 转换

docbook-xsl-1.73.2.tar.gz

docbook-dsssl-1.79.tar.gz

rxp - A validating XML parser

rxp -s file.xml

To validate file.xml, use the command:

$ rxp -s -V file.xml

2.2.1. xsltproc - XSLT command line processor

xsltproc --stringparam html.stylesheet docbook.css ../../docbook-xsl-1.73.2/xhtml/chunk.xsl ../book.xml

$ sudo apt-get install docbook-xsl
$ export DSSSL=/usr/share/xml/docbook/stylesheet/nwalsh/xhtml/chunk.xsl
$ /usr/bin/xsltproc --stringparam html.stylesheet docbook.css ${DSSSL} ../book.xml

			

2.2.2. docbook-ebnf - EBNF module for the XML version of the DocBook DTD

docbook-ebnf - EBNF module for the XML version of the DocBook DTD

$ sudo apt-get install docbook-ebnf
			

2.2.3. docbook-xsl-saxon

$ sudo apt-get install docbook-xsl-saxon
			

创建一个test.xml的测试文件

			
SRCS = test.xml

DESTDIR = .

all: html

html: $(SRCS:.xml=.noext.html) $(SRCS:.xml=.html)

%.png : %.png.uu
	[ -d ${DESTDIR} ] || mkdir -p ${DESTDIR}
	uudecode -o /dev/stdout < $< > ${DESTDIR}/$@

%.html : %.xml
	[ -d ${DESTDIR} ] || mkdir -p ${DESTDIR}
	java -cp "/usr/share/java/saxon.jar:/usr/share/java/xslthl.jar:/usr/share/java/docbook-xsl-saxon.jar" \
	  -Dhighlight.xslthl.config="/usr/share/xml/docbook/stylesheet/docbook-xsl/highlighting/xslthl-config.xml" \
	  com.icl.saxon.StyleSheet \
	  -u -o ${DESTDIR}/$@ $< db2html.xsl \
	  highlight.source=1

%.noext.html : %.xml
	[ -d ${DESTDIR} ] || mkdir -p ${DESTDIR}
	xsltproc --xinclude --nonet -o ${DESTDIR}/$@ \
			--stringparam highlight.source 1 \
			--stringparam xslthl.config /usr/share/xml/docbook/stylesheet/docbook-xsl/highlighting/xslthl-config.xml \
			--param use.extensions 0 \
			--stringparam  paper.type A4 \
			db2html.xsl $<

validate: check

check:
	xmllint --xinclude --nonet --noout --postvalid $(SRCS)

clean:
	rm -f ${DESTDIR}/*.html ${DESTDIR}/*.png

.PHONY: all check clean html validate
			
			

生成html

cp  /usr/share/doc/docbook-xsl-saxon/examples/db2html.xsl 。

make html