Project

General

Profile

1
<?xml version="1.0" encoding="ISO-8859-1"?>
2

    
3
<!--
4
Description: geberates an HTTP payload to execute a WPS request
5
Author:      adair
6
Licence:     LGPL as specified in http://www.gnu.org/copyleft/lesser.html .
7

    
8
$Id$
9
$Name$
10
-->
11

    
12
<xsl:stylesheet version="1.0" 
13
    xmlns:wps="http://www.opengis.net/wps"
14
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
15
		xmlns:ogc="http://www.opengis.net/ogc"
16
    xmlns:ows="http://www.opengis.net/ows"
17
    xmlns:mb="http://mapbuilder.sourceforge.net/mapbuilder" 
18
		xmlns:gml="http://www.opengis.net/gml"
19
    xmlns:xlink="http://www.w3.org/1999/xlink">
20

    
21
  <xsl:output method="xml" omit-xml-declaration="no" encoding="utf-8" indent="yes"/>
22

    
23
  <xsl:param name="httpMethod">get</xsl:param>
24
  <xsl:param name="version"/>
25
  <xsl:param name="processName"/>
26
  <xsl:param name="store">false</xsl:param>
27
  
28
  <!-- template rule matching source root element -->
29
  <xsl:template match="wps:Process">
30
    <wps:Execute version="{$version}" service="WPS">
31
      <xsl:attribute name="store"><xsl:value-of select="$store"/></xsl:attribute>
32
      <xsl:choose>
33
        <xsl:when test="$httpMethod='post'">
34
        	<wps:ProcessName><xsl:value-of select="$processName"/></wps:ProcessName>
35
        </xsl:when>
36
        <xsl:otherwise>
37
          <mb:QueryString>
38
            <xsl:variable name="query">
39
        request=Execute
40
   &amp;service=WPS
41
   &amp;version=<xsl:value-of select="$version"/>
42
  &amp;ProcessName=<xsl:value-of select="wps:Name"/>
43
              <xsl:apply-templates select="wps:Input"/>
44
            </xsl:variable>
45
            <xsl:value-of select="translate(normalize-space($query),' ', '' )" disable-output-escaping="no"/>
46
          </mb:QueryString>
47
        </xsl:otherwise>
48
      </xsl:choose>
49
      <xsl:apply-templates select="wps:Output"/>
50
    </wps:Execute>
51
  </xsl:template>
52
      
53
  <xsl:template match="wps:Output/wps:Parameter">
54
    &amp;<xsl:value-of select="wps:Name"/>=<xsl:apply-templates select="wps:Datatype"/>
55
  </xsl:template>
56

    
57
  <xsl:template match="wps:Input/wps:Parameter">
58
    &amp;<xsl:value-of select="wps:Name"/>=<xsl:apply-templates select="wps:Datatype"/>
59
  </xsl:template>
60

    
61
  <xsl:template match="wps:Datatype/wps:Reference">
62
    <xsl:value-of select="@xlink:href"/>
63
  </xsl:template>
64

    
65
  <xsl:template match="wps:Datatype/wps:LiteralValue">
66
    <xsl:value-of select="."/>
67
  </xsl:template>
68

    
69
  <xsl:template match="wps:Datatype/wps:ComplexValue">
70
    <xsl:value-of select="."/>
71
  </xsl:template>
72

    
73
  <xsl:template match="wps:Datatype/wps:BoundingBox">
74
    <xsl:value-of select="."/>
75
  </xsl:template>
76

    
77
  <xsl:template match="text()|@*"/>
78

    
79
</xsl:stylesheet>
(14-14/14)