- sample ディレクトリを作成し、build.xml, sample.xml, sample.xsl doc.css を置く
- build.xml
<project name="docbooktest" basedir="." default="xslt"> <property name="DOCBOOK_DTD" value="c:/usr/docbook/docbook-xml-4.5/docbookx.dtd"/> <property name="DOCBOOK_PUBLIC_ID" value="-//OASIS//DTD DocBook XML V4.5//EN"/> <property name="XSLDIR" value="c:/usr/docbook/docbook-xsl-1.75.0"/> <property name="LIBDIR" value="c:/usr/docbook/xalan-j_2_7_1/build"/> <property name="XALANJAR" value="${LIBDIR}/xalan.jar"/> <target name="xslt"> <xmlvalidate warn="false"> <xmlcatalog> <dtd publicId="${DOCBOOK_PUBLIC_ID}" location="${DOCBOOK_DTD}"/> </xmlcatalog> <fileset dir="${basedir}"> <include name="sample.xml"/> </fileset> </xmlvalidate> <xslt basedir="${basedir}" destdir="${basedir}" style="${basedir}/sample.xsl" extension=".html" includes="sample.xml"> <classpath> <pathelement location="${XALANJAR}"/> </classpath> <xmlcatalog> <dtd publicId="${DOCBOOK_PUBLIC_ID}" location="${DOCBOOK_DTD}"/> </xmlcatalog> </xslt> </target> <target name="all" depends="xslt"/> <target name="clean"> <delete file="sample.html"/> </target> </project>
- sample.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> <article> <title>DocBook sample</title> <sect1> <title>Hello World</title> <para>Hello World</para> </sect1> <sect1>
- sample.xsl
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:import href="../docbook-xsl-1.75.0/html/docbook.xsl"/> <xsl:output method="html" encoding="UTF-8" indent="yes"/> <xsl:param name="admon.graphics" select="1"/> <xsl:param name="section.autolabel" select="1"/> <xsl:param name="html.stylesheet">doc.css</xsl:param> <xsl:param name="default.encoding" select="'UTF-8'"/> </xsl:stylesheet>
- doc.css
H1.title { padding: 5px 5px 5px 10px; border-left: 10px solid blue; border-bottom: 2px solid blue; } H2.title { padding: 3px 3px 3px 5px; border-left: 5px solid blue; border-bottom: 2px solid blue; } H3.title { padding: 3px 3px 3px 5px; border-left: 5px solid blue; border-bottom: 1px solid blue; } H4.title { padding: 3px 3px 3px 5px; border-left: 5px solid blue; border-bottom: 1px solid blue; } DIV.article { margin: 30px 30px 30px 30px; } DIV.caution { background: #FFCCCC; } DIV.important { background: #FFCCCC; } DIV.note { background: #CCCCFF; } DIV.tip { background: #CCCCFF; } DIV.warning { background: #FFCCCC; } PRE.programlisting { border-width: 1ex; border-color: blue; border-style: solid; color: white; background-color: blue; } PRE.screen { border-width: 1ex; border-color: black; border-style: solid; color: white; background-color: black; } BODY { font-family: gill, helvetica, sans-serif; font-size: 12pt; }
- build.xml
- sample ディレクトリ内で ant を実行し build を行う
2013年3月8日金曜日
[DocBook]Windows で動作確認
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿