EliJDonahue
11/28/2016 - 8:45 PM

Use CSS counters to auto-number specific child elements within Aras Tech Doc sections

Use CSS counters to auto-number specific child elements within Aras Tech Doc sections

/* Set a CSS counter using counter-reset (starts at 0) */
body {
    counter-reset: sectionNum;
    counter-reset: subtitleNum;
}

/* Increment sectionNum counter at each .Section element 
   Reset subtitleNum counter at each .Section element
*/
.Section {
    counter-increment: sectionNum;
    counter-reset: subtitleNum;
}

/* Display sectionNum value before each Section Title */
.Section>.Title::before {
    content: counter(sectionNum, upper-alpha) ". ";
}

/* Increment subtitleNum counter at each Subtitle in a Section */
.Section>.Subtitle {
    counter-increment: subtitleNum;
}

/* Display subtitleNum value before the text contents of the Section's Subtitle */
.Section>.Subtitle>.XmlSchemaText::before {
    content: counter(subtitleNum) ". ";
}
<!-- Add subtitles to Section definition in Document Type schema -->
<xs:element name="Section">
  <xs:complexType>
    <xs:sequence>
      <xs:element ref="Title" minOccurs="1" maxOccurs="1"/>
      <xs:choice maxOccurs="unbounded">
        <xs:element ref="Subtitle"/>
        <xs:element ref="Text"/>
        <xs:element ref="List"/>
        <xs:element ref="Table"/>
        <xs:element ref="Graphic-Block"/>
      </xs:choice>
    </xs:sequence>
  </xs:complexType>
</xs:element>