Hi,
as documented in another thread I'm using the process command copyDocument
for creating and replacing document parts with references.
My problem is that copyDocument changes the filerefs in the newly created
document part and these filerefs become wrong.
Let me explain it with a sample. We always use the following
directory-structure for DocBook-documents:
- ...
- docs
- docs-main <<< for books, articles
- docs-parts <<< for referenced parts (chapters, sections,
...)
- figures
- ...
This is the original "main-document" in docs/docs-main:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE book PUBLIC "-//GAD//DTD DocBook XML V4.2-Variant//EN"
"../../../import/dochb_zentral/docbook/docbook-xml-4.2/gad-docbookx.dtd">
<book lang="de">
<title>Buchtitel</title>
<chapter>
<title>Dies ist ein Kapitel</title>
<section>
<title>Dies ist ein Abschnitt</title>
<para>Dies ist ein para</para>
</section>
</chapter>
<chapter>
<title>This is a chapter</title>
<section>
<title>This is a section</title>
<para>para</para>
<figure>
<title>test figure</title>
<mediaobject>
<imageobject>
<imagedata fileref="../figures/Test.png" />
</imageobject>
</mediaobject>
</figure>
</section>
</chapter>
</book>
Then I call a macro command which calls the following process command:
<command name="copy-docu">
<process>
<copyDocument to="%0" <<< this is ../docs-parts/
test-chapter-reference.xml
selection = "true"
preserveEntityRefs = "false"
preserveXIncludes = "true"
indent="true"
encoding="ISO-8859-1" />
<read file="%0" encoding="ISO-8859-1" />
</process>
</command>
This is the newly created part of the main-document:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE chapter PUBLIC "-//GAD//DTD DocBook XML V4.2-Variant//EN"
"../../../import/dochb_zentral/docbook/docbook-xml-4.2/gad-docbookx.dtd">
<chapter>
<title>This is a chapter</title>
<section>
<title>This is a section</title>
<para>para</para>
<figure>
<title>test figure</title>
<mediaobject>
<imageobject>
<imagedata fileref="./Test.png" /> <<< this is wrong
</imageobject>
</mediaobject>
</figure>
</section>
</chapter>
This is the new "main-document" with a reference to the part in
.../docs/docs-parts:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE book PUBLIC "-//GAD//DTD DocBook XML V4.2-Variant//EN"
"../../../import/dochb_zentral/docbook/docbook-xml-4.2/gad-docbookx.dtd">
<book lang="de">
<title>Buchtitel</title>
<chapter>
<title>Dies ist ein Kapitel</title>
<section>
<title>Dies ist ein Abschnitt</title>
<para>Dies ist ein para</para>
</section>
</chapter>
<xi:include href="../docs-parts/test-chapter-reference.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"
xpointer="element(/1)" />
</book>
The fileref has been automatically changed by copyDocument. Either it
should have been preserved or it should have been refreshed:
in both cases the result should have been: ../figures/Test.png
Is it a bug or can you explain, why the fileref was changed to ./Test.png?
Or what can I do to preserve the filerefs?
By the way I have another question:
The process command copyDocument creates the file with <!DOCTYPE chapter
.... So the following " include-replace"-command does (can) not use
entities for the reference in the main document. Instead it uses
xi:include with xpointer. How can I manage to get entity-references?
Thank you for your help in advance
Best Regards
Peter Schulte
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20051130/3234322f/attachment.htm