| 1 | <xsl:stylesheet version="1.0" |
|---|
| 2 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|---|
| 3 | xmlns:ows="http://www.opengis.net/ows/1.1" |
|---|
| 4 | xmlns:wps="http://www.opengis.net/wps/1.0.0" |
|---|
| 5 | xmlns:xlink="http://www.w3.org/1999/xlink"> |
|---|
| 6 | <!-- |
|---|
| 7 | Author : Gérald FENOY |
|---|
| 8 | |
|---|
| 9 | Copyright 2015 GeoLabs SARL. All rights reserved. |
|---|
| 10 | |
|---|
| 11 | Permission is hereby granted, free of charge, to any person obtaining a copy |
|---|
| 12 | of this software and associated documentation files (the "Software"), to deal |
|---|
| 13 | in the Software without restriction, including without limitation the rights |
|---|
| 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|---|
| 15 | copies of the Software, and to permit persons to whom the Software is |
|---|
| 16 | furnished to do so, subject to the following conditions: |
|---|
| 17 | |
|---|
| 18 | The above copyright notice and this permission notice shall be included in |
|---|
| 19 | all copies or substantial portions of the Software. |
|---|
| 20 | |
|---|
| 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|---|
| 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|---|
| 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|---|
| 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|---|
| 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|---|
| 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|---|
| 27 | THE SOFTWARE. |
|---|
| 28 | |
|---|
| 29 | --> |
|---|
| 30 | <xsl:output method="text"/> |
|---|
| 31 | |
|---|
| 32 | <xsl:template match="/*"> |
|---|
| 33 | <xsl:for-each select="./ProcessDescription"> |
|---|
| 34 | <xsl:call-template name="extractBasicMetaData"> |
|---|
| 35 | <xsl:with-param name="context" select="." /> |
|---|
| 36 | <xsl:with-param name="total" select="1" /> |
|---|
| 37 | </xsl:call-template> |
|---|
| 38 | <xsl:text>storeSupported=true</xsl:text> |
|---|
| 39 | <xsl:text>
</xsl:text> |
|---|
| 40 | <xsl:text>statusSupported=true</xsl:text> |
|---|
| 41 | <xsl:text>
</xsl:text> |
|---|
| 42 | <xsl:text>serviceType=Python</xsl:text> |
|---|
| 43 | <xsl:text>
</xsl:text> |
|---|
| 44 | <xsl:text>serviceProvider=</xsl:text> |
|---|
| 45 | <xsl:value-of select="translate(./ows:Identifier,'.','_')" /> |
|---|
| 46 | <xsl:text>
</xsl:text> |
|---|
| 47 | <xsl:text><DataInputs></xsl:text> |
|---|
| 48 | <xsl:text>
</xsl:text> |
|---|
| 49 | <xsl:for-each select="./DataInputs/Input"> |
|---|
| 50 | <xsl:call-template name="extractBasicMetaData"> |
|---|
| 51 | <xsl:with-param name="context" select="." /> |
|---|
| 52 | <xsl:with-param name="total" select="3" /> |
|---|
| 53 | </xsl:call-template> |
|---|
| 54 | <xsl:call-template name="printSpace"> |
|---|
| 55 | <xsl:with-param name="index" select="1" /> |
|---|
| 56 | <xsl:with-param name="total" select="3" /> |
|---|
| 57 | </xsl:call-template> |
|---|
| 58 | <xsl:text>minOccurs = </xsl:text> |
|---|
| 59 | <xsl:value-of select="./@minOccurs" /> |
|---|
| 60 | <xsl:text>
</xsl:text> |
|---|
| 61 | <xsl:call-template name="printSpace"> |
|---|
| 62 | <xsl:with-param name="index" select="1" /> |
|---|
| 63 | <xsl:with-param name="total" select="3" /> |
|---|
| 64 | </xsl:call-template> |
|---|
| 65 | <xsl:text>maxOccurs = </xsl:text> |
|---|
| 66 | <xsl:value-of select="./@maxOccurs" /> |
|---|
| 67 | <xsl:text>
</xsl:text> |
|---|
| 68 | <xsl:call-template name="extractLiteralData"> |
|---|
| 69 | <xsl:with-param name="context" select=". /LiteralData" /> |
|---|
| 70 | </xsl:call-template> |
|---|
| 71 | <xsl:call-template name="extractComplexData"> |
|---|
| 72 | <xsl:with-param name="context" select=". /ComplexData" /> |
|---|
| 73 | </xsl:call-template> |
|---|
| 74 | </xsl:for-each> |
|---|
| 75 | <xsl:text></DataInputs></xsl:text> |
|---|
| 76 | <xsl:text>
</xsl:text> |
|---|
| 77 | <xsl:text><DataOutputs></xsl:text> |
|---|
| 78 | <xsl:text>
</xsl:text> |
|---|
| 79 | <xsl:for-each select="./ProcessOutputs/Output"> |
|---|
| 80 | <xsl:call-template name="extractBasicMetaData"> |
|---|
| 81 | <xsl:with-param name="context" select="." /> |
|---|
| 82 | <xsl:with-param name="total" select="3" /> |
|---|
| 83 | </xsl:call-template> |
|---|
| 84 | <xsl:call-template name="extractComplexData"> |
|---|
| 85 | <xsl:with-param name="context" select=". /ComplexOutput" /> |
|---|
| 86 | <xsl:with-param name="total" select="3" /> |
|---|
| 87 | </xsl:call-template> |
|---|
| 88 | </xsl:for-each> |
|---|
| 89 | <xsl:text></DataOutputs></xsl:text> |
|---|
| 90 | <xsl:text>
</xsl:text> |
|---|
| 91 | </xsl:for-each> |
|---|
| 92 | |
|---|
| 93 | </xsl:template> |
|---|
| 94 | |
|---|
| 95 | <xsl:template name="extractBasicMetaData"> |
|---|
| 96 | <xsl:param name="context" /> |
|---|
| 97 | <xsl:param name="index" select="1" /> |
|---|
| 98 | <xsl:param name="total" select="1" /> |
|---|
| 99 | <xsl:call-template name="printSpace"> |
|---|
| 100 | <xsl:with-param name="index" select="1" /> |
|---|
| 101 | <xsl:with-param name="total" select="$total" /> |
|---|
| 102 | </xsl:call-template> |
|---|
| 103 | <xsl:text>[</xsl:text> |
|---|
| 104 | <xsl:copy-of select="translate($context/ows:Identifier,'.','_')" /> |
|---|
| 105 | <xsl:text>]</xsl:text> |
|---|
| 106 | <xsl:text>
</xsl:text> |
|---|
| 107 | <xsl:call-template name="printSpace"> |
|---|
| 108 | <xsl:with-param name="index" select="1" /> |
|---|
| 109 | <xsl:with-param name="total" select="$total" /> |
|---|
| 110 | </xsl:call-template> |
|---|
| 111 | <xsl:text>Title = </xsl:text> |
|---|
| 112 | <xsl:copy-of select="$context/ows:Title" /> |
|---|
| 113 | <xsl:text>
</xsl:text> |
|---|
| 114 | <xsl:call-template name="printSpace"> |
|---|
| 115 | <xsl:with-param name="index" select="1" /> |
|---|
| 116 | <xsl:with-param name="total" select="$total" /> |
|---|
| 117 | </xsl:call-template> |
|---|
| 118 | <xsl:text>Abstract = </xsl:text> |
|---|
| 119 | <xsl:copy-of select="$context/ows:Abstract" /> |
|---|
| 120 | <xsl:text>
</xsl:text> |
|---|
| 121 | </xsl:template> |
|---|
| 122 | |
|---|
| 123 | <xsl:template name="printSpace"> |
|---|
| 124 | <xsl:param name="index" select="1"/> |
|---|
| 125 | <xsl:param name="total" /> |
|---|
| 126 | <xsl:if test="not($index = $total)"> |
|---|
| 127 | <xsl:text> </xsl:text> |
|---|
| 128 | <xsl:call-template name="printSpace"> |
|---|
| 129 | <xsl:with-param name="index" select="$index + 1" /> |
|---|
| 130 | <xsl:with-param name="total" select="$total" /> |
|---|
| 131 | </xsl:call-template> |
|---|
| 132 | </xsl:if> |
|---|
| 133 | </xsl:template> |
|---|
| 134 | |
|---|
| 135 | <xsl:template name="extractLiteralData"> |
|---|
| 136 | <xsl:param name="context" /> |
|---|
| 137 | <xsl:for-each select="$context"> |
|---|
| 138 | <xsl:call-template name="printSpace"> |
|---|
| 139 | <xsl:with-param name="index" select="1" /> |
|---|
| 140 | <xsl:with-param name="total" select="3" /> |
|---|
| 141 | </xsl:call-template> |
|---|
| 142 | <xsl:text><LiteralData></xsl:text> |
|---|
| 143 | <xsl:text>
</xsl:text> |
|---|
| 144 | <xsl:call-template name="printSpace"> |
|---|
| 145 | <xsl:with-param name="index" select="1" /> |
|---|
| 146 | <xsl:with-param name="total" select="4" /> |
|---|
| 147 | </xsl:call-template> |
|---|
| 148 | <xsl:text>dataType=</xsl:text> |
|---|
| 149 | <xsl:copy-of select="./ows:DataType" /> |
|---|
| 150 | <xsl:text>
</xsl:text> |
|---|
| 151 | <xsl:if test="./ows:AllowedValues"> |
|---|
| 152 | <xsl:call-template name="printSpace"> |
|---|
| 153 | <xsl:with-param name="index" select="1" /> |
|---|
| 154 | <xsl:with-param name="total" select="4" /> |
|---|
| 155 | </xsl:call-template> |
|---|
| 156 | <xsl:text>AllowedValues=</xsl:text> |
|---|
| 157 | <xsl:for-each select="./ows:AllowedValues/ows:Value"> |
|---|
| 158 | <xsl:copy-of select="." /><xsl:if test="position() != last()" ><xsl:text>,</xsl:text></xsl:if> |
|---|
| 159 | </xsl:for-each> |
|---|
| 160 | <xsl:text>
</xsl:text> |
|---|
| 161 | </xsl:if> |
|---|
| 162 | <xsl:choose> |
|---|
| 163 | <xsl:when test="./DefaultValue"> |
|---|
| 164 | <xsl:call-template name="printSpace"> |
|---|
| 165 | <xsl:with-param name="index" select="1" /> |
|---|
| 166 | <xsl:with-param name="total" select="4" /> |
|---|
| 167 | </xsl:call-template> |
|---|
| 168 | <xsl:text><Default></xsl:text> |
|---|
| 169 | <xsl:text>
</xsl:text> |
|---|
| 170 | <xsl:call-template name="printSpace"> |
|---|
| 171 | <xsl:with-param name="index" select="1" /> |
|---|
| 172 | <xsl:with-param name="total" select="5" /> |
|---|
| 173 | </xsl:call-template> |
|---|
| 174 | <xsl:text>value=</xsl:text> |
|---|
| 175 | <xsl:copy-of select="./DefaultValue" /> |
|---|
| 176 | <xsl:text>
</xsl:text> |
|---|
| 177 | <xsl:call-template name="printSpace"> |
|---|
| 178 | <xsl:with-param name="index" select="1" /> |
|---|
| 179 | <xsl:with-param name="total" select="4" /> |
|---|
| 180 | </xsl:call-template> |
|---|
| 181 | <xsl:text></Default></xsl:text> |
|---|
| 182 | <xsl:text>
</xsl:text> |
|---|
| 183 | </xsl:when> |
|---|
| 184 | <xsl:otherwise> |
|---|
| 185 | <xsl:call-template name="printSpace"> |
|---|
| 186 | <xsl:with-param name="index" select="1" /> |
|---|
| 187 | <xsl:with-param name="total" select="4" /> |
|---|
| 188 | </xsl:call-template> |
|---|
| 189 | <xsl:text><Default /></xsl:text> |
|---|
| 190 | <xsl:text>
</xsl:text> |
|---|
| 191 | </xsl:otherwise> |
|---|
| 192 | </xsl:choose> |
|---|
| 193 | <xsl:call-template name="printSpace"> |
|---|
| 194 | <xsl:with-param name="index" select="1" /> |
|---|
| 195 | <xsl:with-param name="total" select="3" /> |
|---|
| 196 | </xsl:call-template> |
|---|
| 197 | <xsl:text></LiteralData></xsl:text> |
|---|
| 198 | <xsl:text>
</xsl:text> |
|---|
| 199 | </xsl:for-each> |
|---|
| 200 | </xsl:template> |
|---|
| 201 | |
|---|
| 202 | <xsl:template name="extractComplexFormat"> |
|---|
| 203 | <xsl:param name="context" /> |
|---|
| 204 | <xsl:for-each select="$context"> |
|---|
| 205 | <xsl:text> mimeType=</xsl:text> |
|---|
| 206 | <xsl:copy-of select="./MimeType" /> |
|---|
| 207 | <xsl:text>
</xsl:text> |
|---|
| 208 | <xsl:if test="./Encoding"> |
|---|
| 209 | <xsl:text> encoding=</xsl:text> |
|---|
| 210 | <xsl:copy-of select="./Encoding" /> |
|---|
| 211 | <xsl:text>
</xsl:text> |
|---|
| 212 | </xsl:if> |
|---|
| 213 | <xsl:if test="./Schema"> |
|---|
| 214 | <xsl:text> schema=</xsl:text> |
|---|
| 215 | <xsl:copy-of select="./Schema" /> |
|---|
| 216 | <xsl:text>
</xsl:text> |
|---|
| 217 | </xsl:if> |
|---|
| 218 | </xsl:for-each> |
|---|
| 219 | </xsl:template> |
|---|
| 220 | |
|---|
| 221 | <xsl:template name="extractComplexData"> |
|---|
| 222 | <xsl:param name="context" /> |
|---|
| 223 | <xsl:for-each select="$context"> |
|---|
| 224 | <xsl:text> <ComplexData></xsl:text> |
|---|
| 225 | <xsl:text>
</xsl:text> |
|---|
| 226 | <xsl:text> <Default></xsl:text> |
|---|
| 227 | <xsl:text>
</xsl:text> |
|---|
| 228 | <xsl:call-template name="extractComplexFormat"> |
|---|
| 229 | <xsl:with-param name="context" select=". /Default/Format" /> |
|---|
| 230 | </xsl:call-template> |
|---|
| 231 | <xsl:text> </Default></xsl:text> |
|---|
| 232 | <xsl:for-each select="./Supported/Format"> |
|---|
| 233 | <xsl:text>
</xsl:text> |
|---|
| 234 | <xsl:text> <Supported></xsl:text> |
|---|
| 235 | <xsl:text>
</xsl:text> |
|---|
| 236 | <xsl:call-template name="extractComplexFormat"> |
|---|
| 237 | <xsl:with-param name="context" select=". " /> |
|---|
| 238 | </xsl:call-template> |
|---|
| 239 | <xsl:text> </Supported></xsl:text> |
|---|
| 240 | </xsl:for-each> |
|---|
| 241 | <xsl:text>
</xsl:text> |
|---|
| 242 | <xsl:text> </ComplexData></xsl:text> |
|---|
| 243 | <xsl:text>
</xsl:text> |
|---|
| 244 | </xsl:for-each> |
|---|
| 245 | </xsl:template> |
|---|
| 246 | |
|---|
| 247 | </xsl:stylesheet> |
|---|