Re: DocBook Assemblies, IDs, and a proposal
Thomas Schraitle <[email protected]> Tue, 21 Jul 2020 20:42:21 +0200
| Newsgroups | gmane.text.docbook.misc |
|---|---|
| Message-ID | <9171408.EFemsHxx1v@tuxedo> |
Hi Bob,
On Dienstag, 21. Juli 2020 18:39:44 CEST Bob Stayton wrote:
> [...] So if you use IDs on descendant elements of topics, we left
> that as an exercise for the reader. 8^)
Thank you for your detailed answer. It helps me to better understand this
concept.
> [...]
> I think allowing the trans:* attributes to the assembly schema would
> provide useful hooks for doing that fixup process during assembly.
Thank you! Great to see that my proposal wasn't completely out of scope.
> If you file an issue request on the DocBook Github site, then it will
> be considered by the DocBook Technical Committee.
Done, see https://github.com/docbook/docbook/issues/163
> Before proceeding, I wonder if anyone knows how DITA handles the issue
> of duplicate IDs?
I have no idea. However, after a little research, I found this:
The id attributes for topic and map elements are true XML IDs and
therefore must be unique with respect to other XML IDs within the scope
of the XML document that contains the topic or map element.
Within documents containing multiple topics, the IDs for all non-topic
elements that have the same nearest ancestor topic element *should* be
unique with respect to each other. The IDs for non-topic elements may be
the same as non-topic elements with different nearest ancestor topic
elements.
Note: Thus, within a single XML document containing multiple peer or nested
topics, the IDs of the non-topic elements only need to be unique
within each topic without regard to the IDs of elements within any
ancestor or descendant topics.
Source: https://docs.oasis-open.org/dita/v1.2/os/spec/archSpec/id.html
In the oXygen forum they posted the following example (taken from https://
www.oxygenxml.com/forum/topic12844.html):
<topic id="t1">
<title>a</title>
<body>
<p id="pid"></p>
</body>
<topic id="t2">
<title>b</title>
<body>
<p id="pid"></p>
</body>
</topic>
</topic>
"The two paragraphs have the same ID but they appear in different topic
contexts so the entire document is valid." If the second <p> element would be
inside topic[@id='t1']/body, then the whole document wouldn't be valid
anymore.
As far as I understand it, only the @id attributes on topics are true ID type,
other @id attributes on non-topic elements are of type NMTOKEN. See figure 1
"ID requirements summary table" from the above OASIS document.
It seems, the id issue is then resolved/handled by the DITA Open Toolkit. I
would assume, it will display any warnings or error messages. However, I
haven't tested that yet.
Does that help?
--
Gruß/Regards
Thomas Schraitle