At 2018-05-20T22:32:52+01:00, Peter Flynn wrote:
> I haven't used LaTeX for authoring since the early 90s: everything has
> been in SGML and then XML, and transformed to LaTeX for formatting, so
> its lack of formal structure has not concerned me: it's basically an API
> to create PDFs.
I indeed like the phrase "an API to create PDFs"! I wish I knew, in the
90s, someone who could tell me that.
>> I have some experience with DocBook, but, for my current purpose, it
>> has too many elements that are irrelevant.
>
> You can remove the bits you don't want from the RNG and recreate a new
> DTD or Schema. I just ignore them, as I never see them.
I have made a first attempt at extending the RNC, which seemed easier
than extending the RNG. The resulting schema, which I've called
`mono.rnc' is deemed valid by `jing':
$ jing -c mono.rnc && echo "VALID"
VALID
I am also able to convert the RNC to an RNG with trang:
$ trang mono.rnc mono.rng && echo "SUCCESS"
SUCCESS
Now, to use PSGML, I have to convert the RNC to a DTD. However, when I
try to do that with `trang', the command aborts with several errors:
$ trang mono.rnc mono.dtd
/home/raghu/xml/xml/mono.rnc:14:1: error: sorry, combining definitions
with combine="choice" is not supported
/pkg/docbook/rng/docbookxi.rnc:264:6: error: sorry, ambiguous attribute
choice not handled (attribute "type" from namespace
"
http://www.w3.org/1999/xlink")
[...]
I have enclosed the schema `mono.rnc' below. I would be grateful if you
have any suggestions.
> I'd still look at modifying DocBook by removing the bits you don't
> need and writing the new bits along the same lines before making that
> rather final decision. At least that way you benefit from nearly 30
> years of development experience...
The profound experience and expertise that are behind DocBook certainly
make it very attractive. That is the reason I prefer it to PreTeXt,
although the semantics of the latter are, in some ways, closer to what I
am seeking.
> Either way, please bear in mind that the organisers of the Balisage
> conference, the MarkupUK conference, and the assorted TUG conferences
> would always be interested in a paper describing what you have done,
> once its done (or at least, under way).
I would be glad to report on my efforts if they are successful.
Thanks again for all the advice and help.
Raghu.
PS: Here is my first attempt at an RNC.
---------- mono.rnc ----------
# The namespace for all unqualified names. We use the prefix `db' for
# it.
default namespace db = "
http://docbook.org/ns/docbook"
## Include the DocBook schema which allows XInclude.
include "/pkg/docbook/rng/docbookxi.rnc"
## Add a new choice pattern `db.statement.blocks' to the pattern
## `db.formal.blocks'. This makes the `db.statement.blocks' pattern a
## valid option in any context where `db.formal.blocks' appears.
db.formal.blocks |= db.statement.blocks
## The `db.statement.blocks' pattern is itself a choice pattern, whose
## values are the patterns that match definitions, theorems, etc.
db.statement.blocks =
db.corollary
| db.definition
| db.lemma
| db.notation
| db.observation
| db.proposition
| db.theorem
## Here is the definition of the individual values of the
## `db.statement.blocks' choice pattern.
div {
db.corollary = element corollary { db._statement.content }
db.definition = element definition { db._statement.content }
db.lemma = element lemma { db._statement.content }
db.notation = element notation { db._statement.content }
db.observation = element observation { db._statement.content }
db.proposition = element proposition { db._statement.content }
db.theorem = element theorem { db._statement.content }
}
## The content of an individual value of the `db.statement.blocks'
## choice pattern. Adapted from `db.example'.
div {
db._statement.content =
db._statement.attlist
, db._
statement.info
, db.all.blocks +
, db.caption ?
db._statement.attlist =
db._statement.role.attribute ?
& db.common.attributes
& db.common.linking.attributes
& db._statement.label.attribute ?
& db._statement.floatstyle.attribute ?
& ( db._statement.width.attribute | db._statement.pgwide.attribute ) ?
db._
statement.info = db._info.title.onlyreq
db._statement.role.attribute = attribute role { text }
db._statement.label.attribute = db.label.attribute
db._statement.floatstyle.attribute = db.floatstyle.attribute
db._statement.width.attribute = db.width.characters.attribute
db._statement.pgwide.attribute = db.pgwide.attribute
}
---------- mono.rnc ends here ----------