1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <accessor debug="false"> |
---|
3 | <name>/clarin/ws/cmd-core/validate</name> |
---|
4 | <descr>Validate a CMDI instance against the core profile.</descr> |
---|
5 | <param mandatory="true"> |
---|
6 | <name>doc</name> |
---|
7 | <descr>the instance doc to validate</descr> |
---|
8 | <source> |
---|
9 | <param/> |
---|
10 | </source> |
---|
11 | </param> |
---|
12 | <params/> |
---|
13 | <idoc> |
---|
14 | <!-- load profile --> |
---|
15 | <instr> |
---|
16 | <type>sloot.xquery</type> |
---|
17 | <operator> |
---|
18 | <uri>{string(doc('etc/config.xml')/nvp/registry)}/rest/registry/profiles/{string(doc('etc/config.xml')/nvp/profile)}/xml</uri> |
---|
19 | </operator> |
---|
20 | <target>var:prof</target> |
---|
21 | </instr> |
---|
22 | <!-- -X-> |
---|
23 | <instr> |
---|
24 | <type>copy</type> |
---|
25 | <operand> |
---|
26 | <uri>file:///D:/user/menwin/projects/CLARIN/WS/documents/CLARINWebService.xml</uri> |
---|
27 | </operand> |
---|
28 | <target>var:prof</target> |
---|
29 | </instr> |
---|
30 | <!-X- --> |
---|
31 | <accessor-debug> |
---|
32 | <instr> |
---|
33 | <type>log</type> |
---|
34 | <operand>var:prof</operand> |
---|
35 | </instr> |
---|
36 | </accessor-debug> |
---|
37 | <!-- strip doc to core --> |
---|
38 | <instr> |
---|
39 | <type>xslt2</type> |
---|
40 | <operand>var:doc</operand> |
---|
41 | <operator>stripToCore.xsl</operator> |
---|
42 | <core>curi:var:prof</core> |
---|
43 | <target>var:core</target> |
---|
44 | </instr> |
---|
45 | <accessor-debug> |
---|
46 | <instr> |
---|
47 | <type>copy</type> |
---|
48 | <operand>var:core</operand> |
---|
49 | <target>ffcpl:/trace/clarin-ws-cmd-core.validate.core.xml</target> |
---|
50 | </instr> |
---|
51 | </accessor-debug> |
---|
52 | <instr> |
---|
53 | <type>sloot.xquery</type> |
---|
54 | <operator> |
---|
55 | <uri>{string(doc('etc/config.xml')/nvp/registry)}/rest/registry/profiles/{string(doc('etc/config.xml')/nvp/profile)}/xsd</uri> |
---|
56 | </operator> |
---|
57 | <target>var:schema</target> |
---|
58 | </instr> |
---|
59 | <!-- -X-> |
---|
60 | <instr> |
---|
61 | <type>copy</type> |
---|
62 | <operand> |
---|
63 | <uri>file:///D:/user/menwin/projects/CLARIN/WS/documents/CLARINWebService.xsd</uri> |
---|
64 | </operand> |
---|
65 | <target>var:schema</target> |
---|
66 | </instr> |
---|
67 | <!-X- --> |
---|
68 | <accessor-debug> |
---|
69 | <instr> |
---|
70 | <type>log</type> |
---|
71 | <operand>var:schema</operand> |
---|
72 | </instr> |
---|
73 | </accessor-debug> |
---|
74 | <instr> |
---|
75 | <type>validateXSD</type> |
---|
76 | <operand>var:core</operand> |
---|
77 | <operator>var:schema</operator> |
---|
78 | <target>var:report</target> |
---|
79 | </instr> |
---|
80 | <instr> |
---|
81 | <type>xslt2</type> |
---|
82 | <operand>var:core</operand> |
---|
83 | <operator>xmlverbatimwrapper.xsl</operator> |
---|
84 | <target>var:xmlhtml</target> |
---|
85 | </instr> |
---|
86 | <accessor-debug> |
---|
87 | <instr> |
---|
88 | <type>log</type> |
---|
89 | <operand>var:xmlhtml</operand> |
---|
90 | </instr> |
---|
91 | </accessor-debug> |
---|
92 | <instr> |
---|
93 | <type>xslt2</type> |
---|
94 | <operand>var:report</operand> |
---|
95 | <operator> |
---|
96 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> |
---|
97 | <xsl:param name="xmlhtml"/> |
---|
98 | <xsl:template match="text()"/> |
---|
99 | <xsl:template match="/b"> |
---|
100 | <html> |
---|
101 | <head> |
---|
102 | <link href="$site$clarin/ws/cmd-core/style.css" rel="stylesheet" type="text/css"/> |
---|
103 | <link href="$site$clarin/ws/cmd-core/xmlverbatim.css" rel="stylesheet" type="text/css"/> |
---|
104 | <title>CLARIN Web Services: core CMD model for Web Service |
---|
105 | descriptions - validation result</title> |
---|
106 | </head> |
---|
107 | <body> |
---|
108 | <div class="subtitle">Validation result</div> |
---|
109 | <p> |
---|
110 | <xsl:text>The XML document is </xsl:text> |
---|
111 | <xsl:choose> |
---|
112 | <xsl:when test="text()='t'"> |
---|
113 | <xsl:text>a </xsl:text> |
---|
114 | <b>valid</b> |
---|
115 | </xsl:when> |
---|
116 | <xsl:otherwise> |
---|
117 | <xsl:text>an </xsl:text> |
---|
118 | <b>invalid</b> |
---|
119 | </xsl:otherwise> |
---|
120 | </xsl:choose> |
---|
121 | <xsl:text> instance of the CMD core model for CLARIN Web Service descriptions.</xsl:text> |
---|
122 | </p> |
---|
123 | <xsl:if test="errors|warnings"> |
---|
124 | <table class="table report"> |
---|
125 | <thead> |
---|
126 | <tr> |
---|
127 | <th>type</th> |
---|
128 | <th style="text-align:left;">message</th> |
---|
129 | </tr> |
---|
130 | </thead> |
---|
131 | <tbody> |
---|
132 | <xsl:apply-templates/> |
---|
133 | </tbody> |
---|
134 | </table> |
---|
135 | </xsl:if> |
---|
136 | <div class="subtitle">Core instance document generated from the uploaded document</div> |
---|
137 | <p style="xmlverb-default"> |
---|
138 | <xsl:copy-of select="$xmlhtml//body/*"/> |
---|
139 | </p> |
---|
140 | </body> |
---|
141 | </html> |
---|
142 | </xsl:template> |
---|
143 | <xsl:template match="error|warning"> |
---|
144 | <tr> |
---|
145 | <td class="{local-name()}"> |
---|
146 | <xsl:value-of select="local-name()"/> |
---|
147 | </td> |
---|
148 | <td> |
---|
149 | <xsl:value-of select="."/> |
---|
150 | </td> |
---|
151 | </tr> |
---|
152 | </xsl:template> |
---|
153 | </xsl:stylesheet> |
---|
154 | </operator> |
---|
155 | <xmlhtml>var:xmlhtml</xmlhtml> |
---|
156 | <target>var:result</target> |
---|
157 | </instr> |
---|
158 | <instr> |
---|
159 | <type>sloot.xquery</type> |
---|
160 | <operator> |
---|
161 | <nvp> |
---|
162 | {doc('etc/config.xml')/nvp/*} |
---|
163 | {doc('active:ISOcat.manage.system.properties')/nvp/*} |
---|
164 | </nvp> |
---|
165 | </operator> |
---|
166 | <target>var:config</target> |
---|
167 | </instr> |
---|
168 | <instr> |
---|
169 | <type>sloot.render</type> |
---|
170 | <template>var:result</template> |
---|
171 | <attributes>var:config</attributes> |
---|
172 | <target>this:response</target> |
---|
173 | </instr> |
---|
174 | <exception> |
---|
175 | <instr> |
---|
176 | <type>copy</type> |
---|
177 | <operand>this:exception</operand> |
---|
178 | <target>ffcpl:/trace/clarin-ws-cmd-core.validate.exception.xml</target> |
---|
179 | </instr> |
---|
180 | <instr> |
---|
181 | <type>xslt2</type> |
---|
182 | <operand>this:exception</operand> |
---|
183 | <operator> |
---|
184 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> |
---|
185 | <xsl:template match="/"> |
---|
186 | <fieldset style="border: red dotted 1px;padding:1em;"> |
---|
187 | <legend style="font-weight:bold;">An unexpected error occured while validating an instance of the CMD core model for CLARIN Web Service descriptions!</legend> |
---|
188 | <p>The following error occurred:</p> |
---|
189 | <p> </p> |
---|
190 | <quote style="border: gray dotted 1px;margin:1em;padding:1em;background-color:lightgray;"> |
---|
191 | <xsl:value-of select="(.//message)[last()]"/> |
---|
192 | </quote> |
---|
193 | <p> </p> |
---|
194 | <p>If this indicates a problem om the server side please contact: |
---|
195 | <a href="mailto:Menzo.Windhouwer@mpi.nl">Menzo Windhouwer</a>.</p></fieldset> |
---|
196 | </xsl:template> |
---|
197 | </xsl:stylesheet> |
---|
198 | </operator> |
---|
199 | <target>this:response</target> |
---|
200 | </instr> |
---|
201 | </exception> |
---|
202 | </idoc> |
---|
203 | <exception> |
---|
204 | <debug/> |
---|
205 | <trace>ffcpl:/trace/clarin-ws-cmd-core.validate.fatal-exception.xml</trace> |
---|
206 | <throw/> |
---|
207 | </exception> |
---|
208 | <response> |
---|
209 | <debug>ffcpl:/trace/clarin-ws-cmd-core.validate.response.xml</debug> |
---|
210 | <mime>text/html</mime> |
---|
211 | </response> |
---|
212 | </accessor> |
---|