XSLT examples

Example: Valid document.xml

hcixslttest shows all check phases on the document.xml without any warning/error information:

MESSAGE 1
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<svrl:schematron-output xmlns:svrl="http://purl.oclc.org/dsdl/svrl"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:schold="http://www.ascc.net/xml/schematron"
xmlns:iso="http://purl.oclc.org/dsdl/schematron" xmlns:cda="urn:hl7-org:v3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" title="Schematron  schema for validating conformance to CCD documents" schemaVersion="">
<svrl:ns-prefix-in-attribute-values uri="urn:hl7-org:v3" prefix="cda"/>
<svrl:ns-prefix-in-attribute-values uri="http://www.w3.org/2001/XMLSchema-instance" prefix="xsi"/>
<svrl:active-pattern id="p-2.16.840.1.113883.10.20.1-errors" name="CCD v1.0 Templates Root - errors validation phase"/>
<svrl:active-pattern id="p-2.16.840.1.113883.10.20.1-warning" name="CCD v1.0 Templates Root - warning validation phase"/>
<svrl:active-pattern id="p-2.16.840.1.113883.10.20.1-manual" name="CCD v1.0 Templates Root - manual validation phase"/>
…
<svrl:active-pattern id="p-2.16.840.1.113883.10.20.1.58-warning" name="Verification of an advance directive observation - warning validation phase"/>
<svrl:active-pattern id="p-2.16.840.1.113883.10.20.1.58-manual" name="Verification of an advance directive observation - manual validation phase"/>
</svrl:schematron-output>

Example: Invalid document.xml

hcixslttest shows all check phases on the document.xml and indicates warning/error information:

  • Note:
    <svrl:failed-assert test="cda:providerOrganization" location="/*:ClinicalDocument[namespace-uri()='urn:hl7-org:v3']
    [1]/*:recordTarget[namespace-uri()='urn:hl7-org:v3'][1]/*:patientRole[namespace-uri()='urn:hl7-org:v3'][1]"> 
    <svrl:text>
  • Note:
     The providerOrganization element MAY be present. See HL7 History and Physical Note, CONF-HP-36.
    </svrl:text>
    </svrl:failed-assert>
  • Warning:
    <svrl:failed-assert test=".//cda:templateId/@root=&quot;2.16.840.1.113883.3.88.11.83.5&quot;" 
    location="/*:ClinicalDocument[namespace-uri()='urn:hl7-org:v3'][1]/*:component[namespace-uri()='urn:hl7-org:v3']
    [1]/*:structuredBody[namespace-uri()='urn:hl7-org:v3'][1]/*:component[namespace-uri()='urn:hl7-org:v3']
    [1]/*:section[namespace-uri()='urn:hl7-org:v3'][1]">
    <svrl:text>
  • Warning:
    HITSP/C83 Clinical Document, the Payers section will include entries from the Insurance Provider module when 
    this information is known. See HITSP/C83 Section 2.2.1.1, rule C83-[CT-101-2].
    </svrl:text>
    </svrl:failed-assert>
  • Error:
    <svrl:failed-assert test=".//cda:templateId/@root=&quot;2.16.840.1.113883.3.88.11.83.14&quot;" 
    location="/*:ClinicalDocument[namespace-uri()='urn:hl7-org:v3'][1]/*:component[namespace-uri()='urn:hl7-org:v3']
    [1]/*:structuredBody[namespace-uri()='urn:hl7-org:v3'][1]/*:component[namespace-uri()='urn:hl7-org:v3']
    [8]/*:section[namespace-uri()='urn:hl7-org:v3'][1]">
    <svrl:text>
  • Error:
    HITSP/C83 Clinical Document, the Vital Signs section SHALL contain entries conforming to the Vital Sign module. 
    See HITSP/C83 Section 2.2.1.19, rule C83-[CT-119-2].
    </svrl:text>
    </svrl:failed-assert>

You can use the Grep option (-w) to search these keywords in the validation report.