Page 1 of 1
Validation problem with profiling and keywords
Posted: Fri Feb 25, 2022 4:03 pm
by Vinny
Folks,
I have a ‘conref’ dita file, some keywords of which depend on the value of profiling flags included in, say, profiling.ditaval:
profiling.ditafile:
<prop val="A" att="product" action="include"/>
<prop val="B" att="product" action="exclude"/>
conref.dita:
<p>Gas<keyword id="gas" product="A">Butane</keyword></p>
<p>Gas<keyword id="gas" product="B">Propane</keyword></p>
This causes a validation issue ‘duplicate ID found in the same context’, although A and B are never included at the same time (and, it seems irrespective of the fact that I imported the ditafile using the ditamap manager options).
It’s of course no fatal error, but it’s annoying to have that red line popping up each time I use the keyword in the files. Any idea on how to make it disappear?
Thanks!
Re: Validation problem with profiling and keywords
Posted: Sat Feb 26, 2022 3:30 pm
by chrispitude
Hi Vinny,
Originally I was going to suggest that perhaps Oxygen's duplicate @id check should be relaxed when profiling conditions are applied. But then I realized that the XML itself would still fail the requirement that @id attribute values be unique:
https://www.w3.org/TR/REC-xml/#id
I realized that XML does not know (or care) about DITA profiling conditions; it simply requires that the @id values of all XML elements in the document be unique. To XML, a DITA profiling condition is just another attribute value with no significance beyond that...
Perhaps you could define your keyword like this?
Code: Select all
<keyword id="gas"><text product="A">Butane</text><text product="B">Propane</text></keyword>
It is not quite as elegant as what you originally had, but it avoids the duplicate @id violation.
Re: Validation problem with profiling and keywords
Posted: Sat Feb 26, 2022 5:36 pm
by Vinny
Hello!
chrispitude wrote: ↑Sat Feb 26, 2022 3:30 pm
Code: Select all
<keyword id="gas"><text product="A">Butane</text><text product="B">Propane</text></keyword>
It is not quite as elegant as what you originally had, but it avoids the duplicate @id violation.
Let’s say it’s a bit unsettling because the transformation engine doesn’t find anything to complain about. The static validation engine seems pernickety in this case (it does, however, a good job of locating other errors).
Your idea is quite clever. I’ll try that. Thanks for suggesting it!
Have a great weekend,
Vincent
Re: Validation problem with profiling and keywords
Posted: Mon Feb 28, 2022 6:28 am
by Radu
Hi,
I endorse Chris' idea of defining the ID attribute on the keyword and placing inside it the conditional phrases.
Actually ID attributes set on inner DITA elements are not xml:ids, the DITA 1.3 specification:
https://www.oxygenxml.com/dita/1.3/spec ... se/id.html
Within documents that contain multiple topics, the values of the @id attribute for all non-topic elements that have the same nearest-ancestor-topic element should be unique with respect to each other.
So Oxygen has a specific validation check for unique IDs in the context of a DITA topic. Indeed in this case when the content is published with a certain filter, the message may be a bit annoying but in most other cases it's an useful message, especially that at some point people may not be able to fully control what filters are applied on the content at publishing time. Also this case can be fixed by using Chris' idea so I would leave things as they are.
Regards,
Radu