Created
November 28, 2016 20:45
-
-
Save EliJDonahue/1ecc99d5f553f08431eabaf964ce5283 to your computer and use it in GitHub Desktop.
Use CSS counters to auto-number specific child elements within Aras Tech Doc sections
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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) ". "; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment