Document Types > Document Types Available from Arbortext > FOSI Support for DITA Document Types > Priority
  
Priority
When there are multiple e-i-c matches for an element, the FOSI formatting engine must determine the resulting match. It uses the priority of each match, and a specialization penalty that determines the most specialized element match, according to the following rules:
1. If the FOSI has eicorderispriority set to "1", then the priority of an e-i-c match is decided by the e-i-c's order of appearance in the FOSI. That is, the first match in the FOSI is used. In this case, you should order the e-i-c's in the FOSI from most specific to least specific.
* 
For FOSIs generated from Arbortext Styler stylesheets, the eicorderispriority is always always set to "1".
2. If the eicorderispriority is not set or is set to "0", then the e-i-c's with a lower specialization penalty have a higher priority.
3. If the eicorderispriority is not set or is set to "0", and two or more e-i-c's have the same specialization penalty, then the one with the highest match score wins.
Each element name in the e-i-c has a specialization penalty point according to the following rules:
For the element names that directly match their target elements, the penalty is 0.
For the element names that are one level more general than their target elements, the penalty is 1.
For the tag names that are two levels more general than their target elements, the penalty is 2, and so on.
The penalty of the e-i-c is the highest penalty of any element name in the e-i-c.
For example, assume you have the following element mappings in the DTD:
<!ATTLIST refpara class CDATA "- topic/para ref/refpara ">
<!ATTLIST APIsection class CDATA "- topic/section ref/refsection API/APIsection ">
<!ATTLIST APIchapter class CDATA "- topic/chapter ref/refchapter API/APIchapter ">
Assume these e-i-c's are defined in the FOSI:
<e-i-c gi="para">...</e-i-c>
<e-i-c gi="para" context="* chapter">...</e-i-c>
<e-i-c gi="para" context="section">...</e-i-c>
<e-i-c gi="refpara">...</e-i-c>
<e-i-c gi="refpara" context="* refchapter">...</e-i-c>
<e-i-c gi="refpara" context="refsection">...</e-i-c>
<e-i-c gi="refpara" context="* APIchapter">...</e-i-c>
<e-i-c gi="refpara" context="APIsection">...</e-i-c>
All of the above e-i-c's can be matched with the refpara element in the following document fragment.
<APIchapter>
<APIsection>
<refpara>A paragraph.</refpara>
</APIsection>
</APIchapter>
The e-i-c
<e-i-c gi="para">...</e-i-c>
has a penalty of 1, because para is one level more general than refpara. The e-i-c,
<e-i-c gi="refpara">...</e-i-c>,
has a penalty of 0, because the tag name is directly matched with the target element.
The e-i-c:
<e-i-c gi="para" context="* chapter">...</e-i-c>
has a penalty of 2 because the para has 1 penalty point (one level more general than refpara), and the chapter has 2 penalty points (two levels more general than APIchapter.)
Both the following e-i-c's have a penalty of 0, lower than other e-i-c's, so they have a higher precedence over other e-i-c's:
<e-i-c gi="refpara" context="* APIchapter">...</e-i-c>
<e-i-c gi="refpara" context="APIsection">...</e-i-c>
The second e-i-c above has a higher match score. If the eicorderispriority is not set or is set to "0", then this e-i-c- is used to format the element.
* 
When considering whether an element in a document matches an element in a context specification of an e-i-c, the formatter only allows the element in the document to be a specialization of the one in the context specification if there are no e-i-c’s for the element in the context specification in the FOSI. Taking the example above, the e-i-c:
<e-i-c gi="refpara" context="refsection">...</e-i-c>
will only match the refpara in the given document fragment if there is no e-i-c for APIsection. If there is an e-i-c for APIsection, then the formatter assumes that references to refsection in context strings to truly be a refsection, not an APIsection. This qualification makes it possible to get the generally desired results when the eicorderispriority is set to "1". If there is not an e-i-c for APIsection, then you should put an e-i-c for APIsection before the e-i-c for refsection when eicorderispriority is set to "1". Otherwise, the e-i-c for APIsection will never be used.