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

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

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


Subject: validating and transforming a simple docbook5 file in fedora linux



  as a followup to my earlier post, to get started with both docbook5
and relaxng, i wanted to figure out the basic commands to do that
validation and transformation on my fedora 12 box using
yum-installable f12 packages, so anyone is free to tell me if i'm
making this more difficult than it has to be.

  first, here's my incredibly trivial test.db5:

<?xml version="1.0"?>
<book xmlns="http://docbook.org/ns/docbook"; version="5.0">
  <info>
      <title>My book title</title>
      <subtitle>My subtitle</subtitle>
  </info>
</book>

so far, so good?  and, based on my reading so far (just getting
started), there's nothing i can add to associate that file with a
particular relaxng schema is there?  equivalent to a DTD
specification?

  next, i can dig into my docbook5-schemas package to see the files:
...
/usr/share/xml/docbook5/schema/rng
/usr/share/xml/docbook5/schema/rng/5.0
/usr/share/xml/docbook5/schema/rng/5.0/catalog.xml
/usr/share/xml/docbook5/schema/rng/5.0/docbook.rnc
/usr/share/xml/docbook5/schema/rng/5.0/docbook.rng
/usr/share/xml/docbook5/schema/rng/5.0/docbookxi.rnc
/usr/share/xml/docbook5/schema/rng/5.0/docbookxi.rng
...

  if i just want to validate that file against the relaxng schema with
xmllint, i have to *explicitly* list the schema file as follows,
correct?

$ xmllint --relaxng /usr/share/xml/docbook5/schema/rng/5.0/docbook.rng test.db5
<?xml version="1.0"?>
<book xmlns="http://docbook.org/ns/docbook"; version="5.0">
  <info>
      <title>My book title</title>
      <subtitle>My subtitle</subtitle>
  </info>
</book>
test.db5 validates
$

  any shortcuts for that?  as in (like i asked before) incorporating a
reference to the schema in the file itself?

  and finally, to generate the HTML, i can use the handy-dandy "xmlto"
utility but i have to explicitly skip validation since the underlying
xsltproc program that will be called can't validate relaxng.

$ xmlto html test.db5
xmlto: /home/rpjday/docbook/test.db5 does not validate (status 3)
xmlto: Fix document syntax or use --skip-validation option
validity error : no DTD found!
Document /home/rpjday/docbook/test.db5 does not validate

$ xmlto --skip-validation html test.db5
Note: namesp. cut : stripped namespace before processing           My book title
WARNING: cannot add @xml:base to node set root element.  Relative paths may not work.
Note: namesp. cut : processing stripped document                   My book title
Writing index.html for book

  and that seems to work.  so, to summarize (and let me know if i'm
out to lunch here):

1) my test.db5 file is an adequate example of docbook5 input.

2) if i want to validate against a relaxng schema with xmllint, i
*must* explicitly do it as i did above, since db5 doesn't support(?)
adding an internal reference to that kind of schema, correct?

3) at this time, actual processing utilities may not have relaxng
support so it's wise to separate the validation step from the
processing step, as i did above.

  any comments on the above?  simplifications?  blatant oversights?

rday

p.s.  for no good reason, i want to clarify these steps so i can write
a one-page wiki entry on how to get started playing with docbook5 on
fedora linux.

--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================


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