Topics

Constraint on <li> with minimum one occurrence of <cite> #specialization


Wito Zoerkler
 

Hi all,

Currently I am creating a specialization and a small part of it is a constraint on the <li> element. 
The specialization environment and the integration of the <li> constraint module works, tested with  the following code snippet of the <li> constraint module:
...
<!ENTITY % listitem.cnt.bibliography 
  "#PCDATA |
   %cite; |
   %text; |
   %tm; |
   %xref; |
   %draft-comment;"
>
 
<!--                    Override the list item content module      -->
<!ENTITY % li.content    "(%listitem.cnt.bibliography;)*"       
 
Now I would like to have minimum one occurrence of <cite> element but I can't get it to work.
I always get validation errors, no matter how I try to implement it grammatically.
 
Does anyone have an idea how to make it work or does it not work with a constraint?
 
Cheers
Wito


ekimber@contrext.com
 

You cannot do what you want using DTD syntax because the content model includes #PCDATA, which is only allowed in repeating OR groups. That means you cannot have a content model that both requires a specific element and allows #PCDATA. This is an XML DTD syntax limitation, not a DITA limitation.

The normal approach to enforcing this kind of rule is to define a Schematron that checks the rule--Oxygen XML makes it easy to add additional Schematrons to the base DITA validation scenarios and other editors should as well.

Cheers,

E.

--
Eliot Kimber
http://contrext.com


On 8/5/20, 4:13 AM, "Wito Zoerkler" <main@dita-users.groups.io on behalf of wito.zoerkler@...> wrote:

Hi all,

Currently I am creating a specialization and a small part of it is a constraint on the <li> element.
The specialization environment and the integration of the <li> constraint module works, tested with the following code snippet of the <li> constraint module:
...
<!ENTITY % listitem.cnt.bibliography
"#PCDATA |
%cite; |
%text; |
%tm; |
%xref; |
%draft-comment;"
>

<!-- Override the list item content module -->
<!ENTITY % li.content "(%listitem.cnt.bibliography;)*"

Now I would like to have minimum one occurrence of <cite> element but I can't get it to work.
I always get validation errors, no matter how I try to implement it grammatically.

Does anyone have an idea how to make it work or does it not work with a constraint?

Cheers
Wito


Wito Zoerkler
 

Thanks, Eliot!
Your answer makes sense, and I save a lot of time in the further trial and error.
Schematron should do it.

Cheers,
Wito