Entity selection and shared files

Questions about XML that are not covered by the other forums should go here.
george0abitbol
Posts: 7

Entity selection and shared files

Fri Oct 24, 2014 4:45 pm

Hello
I'm using Oxygen 16.1 and DocBook 5 to generate our technical documentation.

I'm desperatley trying to find a way to use entities in shared files.
Let me explain. Imagine bookprod1 and bookprod2 organized as follows:

bookprod1:
============================

Code: Select all

<book> c:\doc\prod1\bookprod1
|_<xi:include.....c:\doc\prod1\chapter1.xml />
|_<xi:include.....c:\doc\prod1\chapter2.xml />
|_<xi:include.....c:\doc\common\common.xml />
</book>


bookprod2:
=============================

Code: Select all

<book> c:\doc\prod2\bookprod2
|_<xi:include.....c:\doc\prod2\chapter1.xml />
|_<xi:include.....c:\doc\prod2\chapter2.xml />
|_<xi:include.....c:\doc\common\common.xml />
</book>

===============================

Imagine also the following entity files declaring the "ent1" entity
[*]c:\doc\prod1\release_and_product-specific_entities.ent where ent1=prod1ent1
[*]c:\doc\prod2\release_and_product-specific_entities.ent where ent1=prod2ent1

Note that :
[*]c:\doc\common\common.xml is used in both books
[*]the "ent1" entity is inserted in c:\doc\common\common.xml. As a consequence, I expect that it returns a distinct value depending on which book is processed.


My issue is that the "ent1" entity that is returned in c:\doc\common\common.xml is always the same. I understand that it may select the first entity file that resolves "ent1".

I thought that setting up Catalogs would allow me to redirect the entity file selection depending on which book is generated, but it has no effect. As a matter of fact, I set two catalog files, one in c:\doc\prod1\ and the other one in c:\doc\prod2\. Each file defined a rewritePrefix rule that redirected to the appropriate entity file. Anyway, this has no effect since Oxygen seems to select the first catalog that solves the issue.

Do you have any idea ? Is there any way to use entities in a "common file" and return a different value for an entity depending on the book that is processed ? Regarding catalogs, is there a way to specify that Book A uses rules from Catalog A and Book B relies on Catalog B ?

Thanks a lot for your help.

George
Radu
Posts: 5585

Re: Entity selection and shared files

Mon Oct 27, 2014 9:47 am

Hi George,

When an XML document (like common.xml) is xi:included, it needs to be self contained, to be well-formed all by itself so all entities it references need to be defined in it.
For example if the common.xml would have the following content:

Code: Select all

<!DOCTYPE sect1>
<sect1>
    <title>&abc;</title>
</sect1>


it would be invalid because it references an entity which it does not define. But if it would also define the entity in the DOCTYPE header, then the entity value is fixed and cannot be changed by making changes some place else.

I think that besides using the profiling support offered in Docbook to include or exclude elements based on certain attribute values your other choice would be to include the content from the "common.xml" using entity references and not xi:include.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
george0abitbol
Posts: 7

Re: Entity selection and shared files

Mon Oct 27, 2014 12:27 pm

Thanks Radu.
So, you mean that an entity value is fixed when parsing the file in Oxygen ? It is not possible to change it afterwards ?
I already use profiling for such a feature but I was hoping that I would be able to set up generic enties whose value would change depending on the context (product, guide, etc.).
Too bad.

Thank you again.
Radu
Posts: 5585

Re: Entity selection and shared files

Mon Oct 27, 2014 3:01 pm

Hi George,

What I'm saying is that when xi:including a file, according to the xi:include specification that file needs to be self contain in regard to entities, you cannot define an entity in the master XML file and then refer to it in the xi:included module, because the module is not valid in itself.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 1 guest