|
16 | 16 | <xsl:variable name="filename" select="concat('SPECS-', @key, '.xml')"/>
|
17 | 17 | <xsl:variable name="specs" select="document($filename, .)/specifications" as="element(specifications)?"/>
|
18 | 18 | <xsl:if test="not($specs)">
|
19 |
| - <xsl:message terminate="yes" select="concat('Unable to find specifications for family ', @key, ' - looking for file ', $filename)"/> |
| 19 | + <xsl:message terminate="yes" select="concat('ERROR: Unable to find specifications for family ', @key, ' - looking for file ', $filename)"/> |
20 | 20 | </xsl:if>
|
21 | 21 | <xsl:apply-templates mode="familySpecs" select="$specs">
|
22 | 22 | <xsl:with-param name="prefix" select="@key" tunnel="yes"/>
|
|
68 | 68 | <xsl:template mode="familySpecs" match="specifications/specification">
|
69 | 69 | <xsl:param name="prefix" tunnel="yes"/>
|
70 | 70 | <xsl:for-each select="page/@url[.=ancestor::specification/page/otherpage/@url]">
|
71 |
| - <xsl:message terminate="yes" select="concat('The same name is present in both page/@url and page/otherpage/@url: ', .)"/> |
| 71 | + <xsl:message terminate="yes" select="concat('ERROR: The same name is present in both page/@url and page/otherpage/@url: ', .)"/> |
72 | 72 | </xsl:for-each>
|
73 | 73 | <xsl:copy>
|
74 | 74 | <xsl:apply-templates mode="familySpecs" select="@*"/>
|
75 | 75 | <xsl:variable name="filename" select="concat($prefix, '-', @key, '.xml')"/>
|
76 | 76 | <xsl:variable name="spec" select="document($filename, .)/specification" as="element(specification)?"/>
|
77 | 77 | <xsl:variable name="specKey" select="@key"/>
|
78 | 78 | <xsl:if test="not($spec)">
|
79 |
| - <xsl:message terminate="yes" select="concat('Unable to find specification ', @name, ' - looking for file ', $filename)"/> |
| 79 | + <xsl:message terminate="yes" select="concat('ERROR: Unable to find specification ', @name, ' - looking for file ', $filename)"/> |
80 | 80 | </xsl:if>
|
81 | 81 | <xsl:for-each select="$spec">
|
82 | 82 | <xsl:apply-templates mode="familySpecs" select="@*|node()">
|
|
92 | 92 | <xsl:choose>
|
93 | 93 | <xsl:when test="@deprecated='true' or self::page"/>
|
94 | 94 | <xsl:when test="not(@id)">
|
95 |
| - <xsl:message terminate="yes" select="concat('id attribute is mandatory for artifacts that are not deprecated - ', $key)"/> |
| 95 | + <xsl:message terminate="yes" select="concat('ERROR: id attribute is mandatory for artifacts that are not deprecated - ', $key)"/> |
96 | 96 | </xsl:when>
|
97 | 97 | <xsl:when test="contains($prefix, 'FHIR') and not(matches(string(@id), '^([A-Z][a-z]+)+/[A-Za-z0-9\-\.]{1,64}$'))">
|
98 |
| - <xsl:message terminate="yes" select="concat('In FHIR artifact ', $key, ', id value of ', @id, ' does not follow the pattern ResourceName/id')"/> |
| 98 | + <xsl:message terminate="yes" select="concat('ERROR: In FHIR artifact ', $key, ', id value of ', @id, ' does not follow the pattern ResourceName/id')"/> |
99 | 99 | </xsl:when>
|
100 | 100 | <xsl:when test="contains($prefix, 'CDA') and not(matches(@id, '^[0-2](\.(0|[1-9][0-9]*))+$'))">
|
101 |
| - <xsl:message terminate="yes" select="concat('In CDA artifact ', $key, ', id value of ', @id, ' is not an OID', matches(@id, '^[0-2](\\.(0|[1-9][0-9]*))+$'))"/> |
| 101 | + <xsl:message terminate="yes" select="concat('ERROR: In CDA artifact ', $key, ', id value of ', @id, ' is not an OID', matches(@id, '^[0-2](\\.(0|[1-9][0-9]*))+$'))"/> |
102 | 102 | </xsl:when>
|
103 | 103 | </xsl:choose>
|
104 | 104 | <xsl:copy>
|
|
123 | 123 | - Main process
|
124 | 124 | -->
|
125 | 125 | <xsl:template match="/">
|
| 126 | + <!-- Check cross-specification validation rules --> |
| 127 | + <xsl:for-each select="$ballotSpecs/specification[not(starts-with(@gitUrl, 'https://github.com/HL7/')) and not(@deprecated='true') and starts-with(@key, 'FHIR-')]"> |
| 128 | + <xsl:message terminate="yes" select="concat('ERROR: FHIR specifications that are not deprecated must have a gitUrl attribute that starts with ''https://github.com/HL7/'' ', @key)"/> |
| 129 | + </xsl:for-each> |
| 130 | + <xsl:for-each select="$ballotSpecs/specification[not(starts-with(@ciUrl, 'http://build.fhir.org')) and not(@deprecated='true') and starts-with(@key, 'FHIR-')]"> |
| 131 | + <xsl:message select="concat('WARNING: FHIR specifications that are not deprecated SHOULD have a ciUrl attribute that starts with ''http://build.fhir.org'' ', @key, ' - actual was: ', @ciUrl)"/> |
| 132 | + </xsl:for-each> |
| 133 | + <xsl:for-each select="$ballotSpecs/specification[not(starts-with(@url, 'http://hl7.org/fhir')) and not(@deprecated='true') and starts-with(@key, 'FHIR-')]"> |
| 134 | + <xsl:message select="concat('WARNING: FHIR specifications that are not deprecated SHOULD have a url attribute that starts with ''http://hl7.org/fhir'' ', @key, ' - actual was: ', @url)"/> |
| 135 | + </xsl:for-each> |
| 136 | + <xsl:for-each select="$ballotSpecs/specification[@ballotUrl and not(starts-with(@ballotUrl, 'http://hl7.org/'))]"> |
| 137 | + <xsl:message terminate="yes" select="concat('ERROR: If present, ballotUrl must start with ''http://hl7.org/'' ', @key, ' - actual was: ', @ballotUrl)"/> |
| 138 | + </xsl:for-each> |
| 139 | + <xsl:for-each select="distinct-values($ballotSpecs/specification/@gitUrl)"> |
| 140 | + <xsl:if test="count($ballotSpecs/specification[@gitUrl=current()])!=1"> |
| 141 | + <xsl:variable name="dupSpecs" select="string-join($ballotSpecs/specification[@gitUrl=current()]/@key, ', ')"/> |
| 142 | + <xsl:message select="concat('WARNING: Multiple FHIR specifications with the same gitUrl of ''', ., ''': ', $dupSpecs)"/> |
| 143 | + </xsl:if> |
| 144 | + </xsl:for-each> |
| 145 | + <xsl:for-each select="$ballotSpecs/specification[@gitUrl[not(starts-with(., 'https://github.com/'))]]"> |
| 146 | + <xsl:message select="concat('ERROR: GitUrl for specification ', @key, ' must start with ''https://github.com/'': ', @gitUrl)"/> |
| 147 | + </xsl:for-each> |
| 148 | + <xsl:for-each select="$ballotSpecs/specification[@gitUrl[not(starts-with(., 'https://github.com/HL7/'))]]"> |
| 149 | + <xsl:message select="concat('WARNING: GitUrl for specification ', @key, ' SHOULD must start with ''https://github.com/HL7/'': ', @gitUrl)"/> |
| 150 | + </xsl:for-each> |
| 151 | + <xsl:for-each select="distinct-values($ballotSpecs/specification/@url)"> |
| 152 | + <xsl:if test="count($ballotSpecs/specification[@url=current()])!=1"> |
| 153 | + <xsl:variable name="dupSpecs" select="string-join($ballotSpecs/specification[@url=current()]/@key, ', ')"/> |
| 154 | + <xsl:message terminate="yes" select="concat('ERROR: Multiple FHIR specifications with the same url of ''', ., ''': ', $dupSpecs)"/> |
| 155 | + </xsl:if> |
| 156 | + </xsl:for-each> |
| 157 | + <xsl:for-each select="distinct-values($ballotSpecs/specification/@ciUrl)"> |
| 158 | + <xsl:if test="count($ballotSpecs/specification[@ciUrl=current()])!=1"> |
| 159 | + <xsl:variable name="dupSpecs" select="string-join($ballotSpecs/specification[@ciUrl=current()]/@key, ', ')"/> |
| 160 | + <xsl:message terminate="yes" select="concat('ERROR: Multiple FHIR specifications with the same ciUrl of ''', ., ''': ', $dupSpecs)"/> |
| 161 | + </xsl:if> |
| 162 | + </xsl:for-each> |
| 163 | + <xsl:for-each select="distinct-values($ballotSpecs/specification/@ballotUrl)"> |
| 164 | + <xsl:if test="count($ballotSpecs/specification[@ballotUrl=current()])!=1"> |
| 165 | + <xsl:variable name="dupSpecs" select="string-join($ballotSpecs/specification[@ballotUrl=current()]/@key, ', ')"/> |
| 166 | + <xsl:message terminate="yes" select="concat('ERROR: Multiple FHIR specifications with the same ballotUrl of ''', ., ''': ', $dupSpecs)"/> |
| 167 | + </xsl:if> |
| 168 | + </xsl:for-each> |
| 169 | + <xsl:for-each select="distinct-values($ballotSpecs/specification/@ballotUrl)"> |
| 170 | + <xsl:if test="count($ballotSpecs/specification[@ballotUrl=current()])!=1"> |
| 171 | + <xsl:variable name="dupSpecs" select="string-join($ballotSpecs/specification[@ballotUrl=current()]/@key, ', ')"/> |
| 172 | + <xsl:message terminate="yes" select="concat('ERROR: Multiple FHIR specifications with the same ballotUrl of ''', ., ''': ', $dupSpecs)"/> |
| 173 | + </xsl:if> |
| 174 | + </xsl:for-each> |
126 | 175 | <!-- Check to see if any keys have been removed or changed -->
|
127 | 176 | <xsl:for-each select="$oldSpecs/specification">
|
128 | 177 | <xsl:variable name="newSpec" select="$ballotSpecs/specification[@key=current()/@key]" as="element(specification)?"/>
|
129 | 178 | <xsl:if test="not($newSpec)">
|
130 |
| - <xsl:message terminate="yes" select="concat('Specification with effective key ', @key, ' has been removed or changed. Keys should never change - just change the name. Keys should also not usually be removed. Instead, set the ''deprecated'' flag to true. Keys can only be removed if no JIRA tracker references that specification. If this is the case and the key should really be removed, please coordinate with an administrator.')"/> |
| 179 | + <xsl:message terminate="yes" select="concat('ERROR: Specification with effective key ', @key, ' has been removed or changed. Keys should never change - just change the name. Keys should also not usually be removed. Instead, set the ''deprecated'' flag to true. Keys can only be removed if no JIRA tracker references that specification. If this is the case and the key should really be removed, please coordinate with an administrator.')"/> |
131 | 180 | </xsl:if>
|
132 | 181 | <xsl:for-each select="version">
|
133 | 182 | <xsl:variable name="newVersion" select="$newSpec/version[@code=current()/@code]" as="element(version)?"/>
|
134 | 183 | <xsl:if test="not($newVersion)">
|
135 |
| - <xsl:message terminate="yes" select="concat('Version with code ', @code, ' in specification ', parent::specification/@key, ' has been removed or changed. Versions should never change. Keys should also not be removed. Versions can only be removed if no JIRA tracker references that version. If this is the case and the version should really be removed, please coordinate with an administrator.')"/> |
| 184 | + <xsl:message terminate="yes" select="concat('ERROR: Version with code ', @code, ' in specification ', parent::specification/@key, ' has been removed or changed. Versions should never change. Keys should also not be removed. Versions can only be removed if no JIRA tracker references that version. If this is the case and the version should really be removed, please coordinate with an administrator.')"/> |
136 | 185 | </xsl:if>
|
137 | 186 | </xsl:for-each>
|
138 | 187 | <xsl:for-each select="artifact">
|
139 | 188 | <xsl:variable name="newArtifact" select="$newSpec/artifact[@key=current()/@key]" as="element(artifact)?"/>
|
140 | 189 | <xsl:if test="not($newArtifact)">
|
141 |
| - <xsl:message terminate="yes" select="concat('Artifact with key ', @key, ' in specification ', parent::specification/@key, ' has been removed or changed. Keys should never change - just change the name. Keys should also not usually be removed. Instead, set the ''deprecated'' flag to true. Keys can only be removed if no JIRA tracker references that artifact. If this is the case and the key should really be removed, please coordinate with an administrator.')"/> |
| 190 | + <xsl:message terminate="yes" select="concat('ERROR: Artifact with key ', @key, ' in specification ', parent::specification/@key, ' has been removed or changed. Keys should never change - just change the name. Keys should also not usually be removed. Instead, set the ''deprecated'' flag to true. Keys can only be removed if no JIRA tracker references that artifact. If this is the case and the key should really be removed, please coordinate with an administrator.')"/> |
142 | 191 | </xsl:if>
|
143 | 192 | </xsl:for-each>
|
144 | 193 | <xsl:for-each select="page">
|
145 | 194 | <xsl:variable name="newPage" select="$newSpec/page[@key=current()/@key]" as="element(page)?"/>
|
146 | 195 | <xsl:if test="not($newPage)">
|
147 |
| - <xsl:message terminate="yes" select="concat('Page with key ', @key, ' in specification ', parent::specification/@key, ' has been removed or changed. Keys should never change - just change the name. Keys should also not usually be removed. Instead, set the ''deprecated'' flag to true. Keys can only be removed if no JIRA tracker references that page. If this is the case and the key should really be removed, please coordinate with an administrator.')"/> |
| 196 | + <xsl:message terminate="yes" select="concat('ERROR: Page with key ', @key, ' in specification ', parent::specification/@key, ' has been removed or changed. Keys should never change - just change the name. Keys should also not usually be removed. Instead, set the ''deprecated'' flag to true. Keys can only be removed if no JIRA tracker references that page. If this is the case and the key should really be removed, please coordinate with an administrator.')"/> |
148 | 197 | </xsl:if>
|
149 | 198 | </xsl:for-each>
|
150 | 199 | </xsl:for-each>
|
|
0 commit comments