diff --git a/specification/archSpec/base/adding-an-attribute-to-certain-table-elements.dita b/specification/archSpec/base/adding-an-attribute-to-certain-table-elements.dita index 4c955ca4..23576fb1 100644 --- a/specification/archSpec/base/adding-an-attribute-to-certain-table-elements.dita +++ b/specification/archSpec/base/adding-an-attribute-to-certain-table-elements.dita @@ -50,8 +50,8 @@ *existing* attribute domain and using a separate extension module to allow it in specific places, omitting the usual global integration."

- First, the DITA architect creates the attribute - domain module for the cell-purpose attribute: + First, the DITA architect creates the expansion + module for the cell-purpose attribute: acme-cellPurposeAttExpansion.ent.<!-- Define the attribute --> <!ENTITY % cellPurposeAtt-d-attribute-expansion "cell-purpose (sale | out-of-stock | new | last-chance | inherit | none) #IMPLIED" diff --git a/specification/archSpec/base/rng-adding-an-attribute-to-certain-table-elements.dita b/specification/archSpec/base/rng-adding-an-attribute-to-certain-table-elements.dita index edfacaa0..355a797b 100644 --- a/specification/archSpec/base/rng-adding-an-attribute-to-certain-table-elements.dita +++ b/specification/archSpec/base/rng-adding-an-attribute-to-certain-table-elements.dita @@ -17,17 +17,30 @@ - -

Comment from Robert Anderson: "This example feels like it is more complex than it needs to - be but maybe I'm missing something about RNG. If nothing else, I don't understand why we - would define 2 RNG files for this; couldn't we simplify and define the cellPurpose attribute - in the same module tableCellAttExpansion.rng?"

-

From a Skype message from Robert Anderson on 17 May 2021:

-

"I sent all my comments on the proposal a bit ago, but couldn't let it go and went back to - try a simpler way to add extension attributes with RNG. Set up a cellPurpose.rng file that - does it all in one file, without any need to override topicMod.rng like you do with - constraints."

- <?xml version="1.0" encoding="UTF-8"?> +

The DITA architect decides to create a new attribute (cell-purpose) and + add it to the content model of the following elements:

+
    +
  • entry
  • +
  • row
  • +
  • colspec
  • +
  • stentry
  • +
  • strow
  • +
+

The new attribute will be specialized from + base, and it will take a small set of tokens as + values.

+

The DITA architect decides to integrate the attribute declaration + and its assignment to elements into a single expansion module. An + alternate approach would be to put each <!ATTLIST + declaration in its own separate expansion module, thus allowing DITA + architects who construct document-type shells to decide the elements + to which to apply the attribute.

+
    +
  1. +

    The DITA architect creates an expansion module: + cellPurposeAtt.rng. It contains the + following code:

    + <?xml version="1.0" encoding="UTF-8"?> <?xml-model href="urn:oasis:names:tc:dita:rng:vocabularyModuleDesc.rng" schematypens="http://relaxng.org/ns/structure/1.0"?> <grammar @@ -35,6 +48,8 @@ xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:dita="http://dita.oasis-open.org/architecture/2005/" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + + <!-- DEFINE THE ATTRIBUTE SPECIALIZATION --> <define name="cellPurposeAtt"> <optional> <attribute name="cellPurpose"> @@ -53,6 +68,7 @@ </optional> </define> + <!-- ASSIGN THE ATTRIBUTE TO CERTAIN ELEMENTS --> <define name="entry.attributes" combine="interleave"> <ref name="cellPurposeAtt"/> </define> @@ -68,135 +84,37 @@ <define name="colspec.attributes" combine="interleave"> <ref name="cellPurposeAtt"/> </define> -</grammar> -

    when I add that to basetopic.rng with <include href="cellPurpose.rng"/> I'm able to add - cellPurpose to the 5 table elements. Only other change should be to add this to the - specializations declaration in the shell:

    - <attribute name="specializations" - a:defaultValue=" - @props/audience - @props/deliveryTarget - @props/otherprops - @props/platform - @props/product - @base/cellPurpose"/> - -

    The DITA architect decides to create a new attribute (cell-purpose) and - add it to the content model of the following elements:

    -
      -
    • entry
    • -
    • row
    • -
    • colspec
    • -
    • stentry
    • -
    • strow
    • -
    -

    The new attribute will be specialized from base; it will have a small - set of tokens that can be values for the new attribute.

    -
      -
    1. -

      The DITA architect creates an attribute domain module: - cellPurposeAtt.rng. It contains the following code:

      - <?xml version="1.0" encoding="UTF-8"?> -<?xml-model href="urn:oasis:names:tc:dita:rng:vocabularyModuleDesc.rng" - schematypens="http://relaxng.org/ns/structure/1.0"?> -<grammar - xmlns="http://relaxng.org/ns/structure/1.0" - xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" - xmlns:dita="http://dita.oasis-open.org/architecture/2005/" - datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> - <define name="cellPurposeAtt-d-attribute-expansion"> - <optional> - <attribute name="cellPurpose"> - <a:documentation>Specifies the purpose of the table cell. This is a specialized - attribute for Acme Corporation. - </a:documentation> - <choice> - <value>sale</value> - <value>out-of-stock</value> - <value>new</value> - <value>last-chance</value> - <value>inherit</value> - <value>none</value> - </choice> - </attribute> - </optional> - </define> </grammar>
    2. -

      The DITA architect updates the catalog.xml file and - integrates the attribute domain module into the document-type shell:

      - <div> +

      They then update the catalog.xml + file to include the expansion module.

      +
    3. +
    4. +

      They integrate the expansion module into the document-type + shell:

      + <div> <a:documentation>MODULE INCLUSIONS</a:documentation> ... <include href="urn:example:names:tc:dita:rng:cellPurposeAtt.rng:2.0"/> </div> -

      At this point, the new attribute domain is integrated into the document-type - shell. However, the cell-purpose attribute is not added to the - attribute lists for the table elements.

      -
    5. -
    6. -

      Next, the DITA architect creates the expansion module: - tableCellAttExpansion.rng

      - <?xml version="1.0" encoding="UTF-8"?> -<?xml-model href="urn:oasis:names:tc:dita:rng:vocabularyModuleDesc.rng" - schematypens="http://relaxng.org/ns/structure/1.0"?> -<grammar xmlns="http://relaxng.org/ns/structure/1.0" - xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" - xmlns:dita="http://dita.oasis-open.org/architecture/2005/" - datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> - <div> - <a:documentation>CONTENT MODEL AND ATTRIBUTE LIST OVERRIDES</a:documentation> - <include href="urn:oasis:names:tc:dita:rng:topicMod.rng:2.0"> - <define name="topic-info-types"> - <ref name="topic.element"/> - </define> - <define name="colspec.attributes" combine="interleave"> - <optional> - <attribute name="cellPurpose"/> - </optional> - </define> - <define name="entry.attributes" combine="interleave"> - <optional> - <attribute name="cellPurpose"/> - </optional> - </define> - <define name="row.attributes" combine="interleave"> - <optional> - <attribute name="cellPurpose"/> - </optional> - </define> - <define name="stentry.attributes" combine="interleave"> - <optional> - <attribute name="cellPurpose"/> - </optional> - </define> - <define name="strow.attributes" combine="interleave"> - <optional> - <attribute name="cellPurpose"/> - </optional> - </define> - </include> - </div> -</grammar> - -
    7. -
    8. -

      The DITA architect updates the catalog.xml file, and then - integrates the expansion module into the document-type shell:

      - <div> - <a:documentation>ELEMENT-TYPE CONFIGURATION INTEGRATION</a:documentation> - <include href="urn:example:names:tc:dita:rng:tableCellAttExpansion.rng:2.0"/> - </div> - <div> - <a:documentation>MODULE INCLUSIONS</a:documentation> - <include href="urn:oasis:names:tc:dita:rng:topicMod.rng:2.0"> - ... - </div> -

      Note that the DITA architect removed the include element - for topicMod.rng, since that vocabulary module is included - in the expansion module.

      -
    9. + +
    10. They specify the value that the cellPurpose + attribute contributes to the specializations + attribute: <div> + <a:documentation>SPECIALIZATIONS ATTRIBUTE</a:documentation> + <define name="specializations-att"> + <optional> + <attribute name="specializations" a:defaultValue=" + @props/audience + @props/deliveryTarget + @props/otherprops + @props/platform + @props/product + @base/cellPurpose"/> + </optional> + </define> + </div>
    11. After checking the test file to ensure that the attribute lists are modified as expected, the work is done.