As you mention, XMetaL can only validate a wrapper file. To get around
that, I added a macro (pasted below) that looks for a processing
instruction in the format <?parent-doc parentdoc.xml?> in a document if
it doesn't have a DOCTYPE statement, then opens parentdoc.xml if
necessary, switches to it, and validates it. You put this in the
On_Before_Document_Validate event macro and it fires whenever you
validate a doc.
But that may not be the problem you're talking about (I'm not sure
whether you mean validation in the strick sense or in the sense of
providing authoring assistence as you type). Does largechapter.xml have
a DOCTYPE (i.e. the DTD declaration at the top?) or is that in a
book.xml that in turn contains largechapter.xml? A limitation of
XMetaL's handling of entities is that if you include files more than one
level deep, then you can't open the second level. So if you have this
situation: book.xml includes largechapter.xml includes section.xml, then
you can open book.xml, click on an entity to open largechapter.xml, do
any editing you want there with XMetaL letting you know what's allowed
where, but you can't open section.xml from largechapter.xml. This is
really a misfeature/lack of functionality in xmetal.
A workaround that I can think of would be to make some fake wrapper.xml
that includes both largechapter.xml and section.xml directly. The
purpose of wrapper.xml would only be to keep xmetal happy and let you
open section.xml in a way that will let xmetal associate it with it's
dtd.
David
// From On_Before_Document_Validate
if(ActiveDocument.doctype.systemId == ""){
Application.StopValidation();
var parentDoc =
ActiveDocument.getNodesByXPath("//processing-instruction('parent-doc')")
;
// Store the object representing
// the active document
var doc = Application.ActiveDocument;
if(parentDoc.length != 0){
try{
var parentDocObj = Documents.item(ActiveDocument.Path + "\\" +
parentDoc.item(0).nodeValue);
parentDocObj.validate();
if(parentDocObj.isValid){
doc.Activate();
}else{
parentDocObj.Activate();
}
}catch(e){
if(Application.FileExists(ActiveDocument.Path + "\\" +
parentDoc.item(0).nodeValue)){
var parentDocObj2 = Documents.Open(ActiveDocument.Path + "\\" +
parentDoc.item(0).nodeValue);
ActiveDocument.validate();
if(ActiveDocument.isValid){
doc.Activate();
}
}
}
}else{
Application.Alert("Can't validate a document without a DOCTYPE or a
<?parent-doc path-to-parent?>","Sorry");
}
}
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 30, 2008 10:58 AM
To: [email protected]
Subject: [docbook] Is it possible to split chapters ?
Hello,
We are using docbook 4.2 with our own customizations and our
authoring tool is XMetaL 5.0.
Currently we have a very large chapter, largechapter.xml, that
contains reference material.
This chapter is divided into sect1s. For various reasons, we'd
like
to split up the contents of largechapter.xml into three
files/entities and insert the
entities into the largechapter.xml.
What we've done is created three files that contain a list of
sect1s.
For example file1.xml 's hierarchy looks like the following:
<sect1>
referenceA material
</sect1>
<sect1>
referenceB material
</sect1>
...
We have no problem inserting an entity for file1.xml into
largechapter.xml and validating
largechaper.xml. The problem is that we can't validate file1.xml
on its own, because
it does not contain an over-arching root. As a result, it is
difficult for us to edit
file1.xml. Is there a tag that we could use that would fit
within the chapter tag and would
accept sect1s? Or is there another way to do this?
I know that an easy solution would be to convert all the current
sect1s in file1.xml
to sect2s and use one sect1. We'd prefer not to do this as it
would add an
extra level for our users to drill down through.
Any suggestions welcome!
Thank you,
Kate