OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: docbook5 and adding elements (long)


  I've taken a look through the e-mail archives, and I've tried
googling, but I'm unable to find an answer to why I can't do something
that should be quite simple. :(  I've found documentation for how to
do it using Docbook 4.x (and had no luck using it with Docbook 5), but
it *seems* like a good thing to do it in Docbook 5. (Right?)

  I'm hoping that some kind soul can help me understand what it is
that I'm doing wrong.  I think that all I need is one good example.
Thanks in advance!


kells


What I'm trying to do:
================
   I would like to be able to create an application-specific prompt to
create documentation for the application.  The prompt looks like:

  app: server_name>

   where I'd like to define server_name in an entity as an attribute
with a reasonable default.  To illustrate, I'd like to be able to
write:

  <app> <command> bleh </command>
<variable>colour</variable>=<replaceable>blue</replaceable>
  </app>

  <app server="server2" > <command> bleh </command>
<variable>colour</variable>=<replaceable>green</replaceable>
  </app>

  and have the output look something like:

    app: server1> bleh colour=blue
    app: server2> bleh colour=green

Where I am so far
==============
Input file: test.xml
----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book SYSTEM "app.dtd" >

<book version="5.0"
      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";
      xmlns:db="http://docbook.org/ns/docbook";
>

<chapter>
<title>Hello world!</title>
<para>Sample explanatory text here</para>

  <app server="server2" > <command> bleh </command>
<variable>colour</variable>=<replaceable>green</replaceable>
  </app>

</chapter>
</book>



My DTD app.dtd:
------------------------
<?xml version="1.0" encoding="UTF-8"?>

<!--  Add the "app" element to something hopefully similar to what I want. :)
      If I understand things correctly, this inserts the element
definition into
      the right spots in the DocBook grammar (aka DTD).
  -->
<!ENTITY % local.tech.char.class "|app" >

<!--   Other documentation I've seen suggests taking the
        docbook dtd, making a parameter entity and invoking it here.
        It goes badly for me if I do

<!ENTITY % DOCBOOK SYSTEM "file://c:/docbook/lib/docbook-50b5/dtd/docbook.dtd">
%DOCBOOK;

       So I can't use the above. Right?

-->

<!--  Create the "app" element  -->
<!ELEMENT app (#PCDATA|filename|replaceable|constant|parameter)* >

<!-- Set a default server name  -->
<!ATTLIST app server ENTITY "server1" >



My app.xsl
------------------
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                              xmlns:fo="http://www.w3.org/1999/XSL/Format";
                               xmlns:db="http://docbook.org/ns/docbook";
>

<!-- Here's where it starts to get really scary for me. :)
      This is also wrong, but I *think* shows what I want to do.
-->
<xsl:template match="app">
        <xsl:call-template name="db:prompt">
         	<xsl:value-of select="@server" />
        </xsl:call-template>
        &amp;
	<xsl:apply-templates select="." />
</xsl:template>

</xsl:stylesheet>


Invocation with xsltproc
==================
xsltproc --nonet --xinclude --output test.fo app.xsl test.xml


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]