Controlling quality of content within web-editor

This article gives an overview of validation possibilities within AEM Guides web-editor.
By design web-editor leverages the DITA schema setup in the system to enforce users to create DITA compliant content. With this, all the content stored in the sytem is structured, reusable and valid DITA content.

Beyond support for DITA rules, web-editor also supports validation of content based on “Schematron” rules.

Schematron” refers to a rule-based validation language used to define tests for an XML file. You can import the Schematron files and also edit them in Web Editor. Using a “Schematron” file you can define certain rules and then validate them for a DITA topic or a map. Schematron rules can ensure consistency of XML structure by imposing restrictions defined as rules. These restrictions are driven by SMEs who own the quality and consistency of the content.

NOTE: Web editor supports ISO Schematron.

Knowing how “Schematron” works in web-editor

Configuring Schematron rules

Refer section “Support for Schematron files” in the User Guide

Enforce validation rules on file save

Webeditor settings allows the power users to setup Schematron rules/files that will be executed each time a user updates the content. For more details refer section “Validation” in User Guide

Set rules from web-editor settings

Can you run validation manually?

Yes, as a author/user while creating content you can use the Schematron panel in webeditor to upload a schematron file and run validations on the file open in editor.

For this to work, folder profile admin must allow all users to add Schemtron files in Validation panel. See editor settings (screenshot given above)

Choose Schematron file
Run validation

Supported rules

Current version of AEM Guides support validation using “Assertion” based rules only. (see asset vs report)
Any rules based on “Reports” are not supported yet.

Samples and more help on Schematron rules

Sample use cases

  • Check if a link is external and if it has scope “external”

    code language-none
    <sch:pattern>
        <sch:rule context="xref[contains(@href, 'http') or contains(@href, 'https')]">
            <sch:assert test="@scope = 'external' and @format = 'html'">
                All external xref links must be with scope='external' and format='html'
            </sch:assert>
        </sch:rule>
    </sch:pattern>
    
  • Check if there is atleast one “topicref” in a map or atleast one “li” under a “ul”

    code language-none
    <sch:pattern>
        <sch:rule context="map">
            <sch:assert test="count(topicref) > 0">
                There should be atleast one topicref in map
            </sch:assert>
        </sch:rule>
    
        <sch:rule context="ul">
            <sch:assert test="count(li) > 1" >
                A list must have more than one item.
            </sch:assert>
        </sch:rule>
    </sch:pattern>
    
  • The “indexterm” element should always be present in a “prolog”

    code language-none
    <sch:pattern>
        <sch:rule context="*[contains(@class, ' topic/indexterm ')]">
            <sch:assert test="ancestor::node()/local-name() = 'prolog'">
                The indexterm element should be in a prolog.
            </sch:assert>
        </sch:rule>
    </sch:pattern>
    

Resources

recommendation-more-help
11125c99-e1a1-4369-b5d7-fb3098b9b178