[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook] docbook5 and adding elements (long)
On 3/17/07, Chris Chiasson <chris@chiasson.name> wrote: <snip> > > I hate the reading, especially when I don't know exactly what I need to find. > > Experience: What you get after you needed it. </snip> Oh boy, did this experience ever hurt. :( After a fair amount of reading and experimentation, I finally (doh!) realized that the key piece that I was missing is that xsltproc is *not* doing validation, and doesn't need to do validation. I had assumed that it would be a necessary step, but as I'm just looking for print output, I just don't need to worry about grammatically valid XML files. (But now I know how to generate the grammars should I ever want to do so. :) Thanks to a number of hints from Bob and Dick, I've got a workable solution for the question that I posited. Thanks guys! Sample command: ============== xsltproc --nonet --xinclude --output test.fo app.xsl test.xml c:\docbook\fop.bat test.fo test.pdf test.xml ======= <?xml version="1.0" encoding="UTF-8"?> <book version="5.0" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" > <chapter> <title>Hello world!</title> <para>Sample explanatory text here</para> <para> <app server="server2" > <command> bleh </command> <replaceable>green</replaceable> </app> </para> <para> <app> <command> bleh1 </command> <replaceable>orange</replaceable> </app> </para> </chapter> </book> app.xsl ====== <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns="http://docbook.org/ns/docbook" xmlns:db="http://docbook.org/ns/docbook" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" > <xsl:import href="file:///c:/docbook/lib/docbook5-xsl-1.72.0/fo/docbook.xsl"/> <!-- Pretty print the FO output tree (please! :) --> <xsl:output encoding="UTF-8" indent="yes" /> <xsl:template match="db:app"> <fo:inline font-family="monospace">app: <xsl:choose> <xsl:when test="./@server != ''" > <xsl:value-of select="@server" /> </xsl:when> <xsl:otherwise>server1</xsl:otherwise> </xsl:choose>> </fo:inline> <xsl:apply-templates /> </xsl:template> </xsl:stylesheet>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]