Page 1 of 1

Displaying content of document level entities in Author mode

Posted: Wed Aug 19, 2009 10:19 am
by honyk
Hello,

is there any possibility to show the content of defined entities? By default there is displayed only entity name in tag, not content itself. Is there way via CSS's content feature?

Jan

Re: Displaying content of document level entities in Author mode

Posted: Wed Aug 19, 2009 11:23 am
by sorin_ristache
Hello,

By default the content of entities is displayed in Author mode because that is specified by the option Display referred content that is available in Preferences -> Editor -> Pages -> Author and this option is enabled by default. Did you disable this option?


Regards,
Sorin

Re: Displaying content of document level entities in Author mode

Posted: Wed Aug 19, 2009 12:35 pm
by honyk
Option is enabled, there is no problem to load content via xi:includes, but in this case it is not so called referred content I think:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
<!ENTITY atr-ac "Specifies the number of ...">
<!ENTITY atr-ai "Specifies a delay ...">
I don't know exact name, maybe character entities...

Re: Displaying content of document level entities in Author mode

Posted: Wed Aug 19, 2009 2:25 pm
by sorin_ristache
Do you mean showing the entities atr-ac and atr-ai? The declared entities are displayed in the Entities view. They are displayed in the editor where entity references are used, that is &atr-ac; and &atr-ai;.


Regards,
Sorin

Re: Displaying content of document level entities in Author mode

Posted: Wed Aug 19, 2009 4:32 pm
by honyk
You are right. If entities are specified in the main document and used directly in it, they are displayed correctly (I didn't make this easiest proof before). But if they are used in xincluded parts (my case), although defined globally, they are not resolved in Author view of the main document.

Re: Displaying content of document level entities in Author mode

Posted: Wed Aug 19, 2009 5:13 pm
by sorin_ristache
Do you mean to edit an included part file when the current Author document is the master file that includes all part files? That is not possible because the included part files are read-only (have grey background) not because an ID declared in the master file is not available in the auto completion popup for the linkend attribute in an included part file. You can see that when editing the included part file. Just click on the Open icon in the master file at the beginning of the grey area of the included file. The validation scenario with the master file must be set on the part file.


Regards,
Sorin

Re: Displaying content of document level entities in Author mode

Posted: Wed Aug 19, 2009 5:56 pm
by honyk
Finally I am quite sure it is caused by non valid master document. If master document is not valid, its content is not available to child even with properly set validation scenario and hence entities defined there cannot be resolved properly.
From my point of view the master document is valid (despite of Xerces complaints), but I must prove it somehow...

Re: Displaying content of document level entities in Author mode

Posted: Wed Aug 19, 2009 6:21 pm
by honyk
Could somebody explain, what is wrong with the following use case?
Master file (support for xi:include at this place is injected into local DTD):

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
<!ENTITY test "Test of global entity.">
]>
<book>
<title>Test</title>
<xi:include href="external.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</book>
Child file (external.xml):

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<chapter>
<title>Chapter</title>
<para>&test;</para>
</chapter>
I am getting "E [Xerces] The entity "test" was referenced, but not declared." and instead of entity content there is nothing displayed.
Is there some issue with order of resolving xi:includes and entities?

Re: Displaying content of document level entities in Author mode

Posted: Thu Aug 20, 2009 12:12 pm
by sorin_ristache
honyk wrote:Child file (external.xml):

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<chapter>
<title>Chapter</title>
<para>&test;</para>
</chapter>
I am getting "E [Xerces] The entity "test" was referenced, but not declared." and instead of entity content there is nothing displayed.
Is there some issue with order of resolving xi:includes and entities?
Yes, entity references are resolved before xi:include references. That means the entity must be declared in the same file as the reference.


Regards,
Sorin