Hi David,

Thanks for responding!

 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.

I mean validation in the sense of providing authoring assistance as you 
type. The problem with validating the parent-doc is that I can't simply 
click Go To
in the Validation Log when there is an error.

 
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.  We created a workaround for 
XMetaL's entities feature by using a script similar to the one you 
suggested below within the On_Application_Before_Document_Opens event.
 
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. 

So far the solution I've come up with is to change the refentry element in 
docbook so that it allows multiple sect1 tags.
This is what I came up with for the declaration of refentry. Is this OK to 
do in docbook?
<!ELEMENT refentry %ho; (beginpage?,
                    (%ndxterm.class;)?,
                    refentryinfo?, refmeta?, (remark|%link.char.class;)?,
                    refnamediv?, refsynopsisdiv?, 
(sect1+|refsect1+|refsection+))
                %ubiq.inclusion;>


Thus we can create a chapter like the following:
bigfilechapter.xml
<chapter>
        <title> Title </title>
        <para>
        &file1; &file2;
 
</chapter>
file1.xml
<refentry>
        <sect1>
                sect 1 info
        </sect1>
        <sect1>
                sect 1 info
        </sect1>
</refentry>

file2.xml
<refentry>
        <sect1>
                sect 1 info
        </sect1>
        <sect1>
                sect 1 info
        </sect1>
</refentry> 

I've got to talk with the woman who looks after our XSLT build processes 
to see if 
it is possible for her to strip out or ignore the refentry tags during the 
build process.
Otherwise, I'll have to insert and remove the refentry tags in xmetal.

Thanks again,
Kate





"David Cramer" <[EMAIL PROTECTED]> 
01/30/2008 02:33 PM

To
<[EMAIL PROTECTED]>, <[email protected]>
cc

Subject
RE: [docbook]  Is it possible to split chapters ?






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 

Reply via email to