metacat/lib/spatial/mapbuilder/lib/tool/xsl/wfs_Update.xsl @ 3032
1 |
<?xml version="1.0" encoding="ISO-8859-1"?>
|
---|---|
2 |
|
3 |
|
4 |
|
5 |
<!--
|
6 |
|
7 |
Description: Extract FeatureMembers from a FeatureCollection and build
|
8 |
|
9 |
into a WFS Insert transaction.
|
10 |
|
11 |
Author: Cameron Shorter
|
12 |
|
13 |
Licence: LGPL as specified in http://www.gnu.org/copyleft/lesser.html .
|
14 |
|
15 |
|
16 |
|
17 |
$Id$
|
18 |
|
19 |
-->
|
20 |
|
21 |
|
22 |
|
23 |
<xsl:stylesheet version="1.0" |
24 |
|
25 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
26 |
|
27 |
xmlns:wfs="http://www.opengis.net/wfs" |
28 |
|
29 |
xmlns:ogc="http://www.opengis.net/ogc" |
30 |
|
31 |
xmlns:gml="http://www.opengis.net/gml"> |
32 |
|
33 |
|
34 |
|
35 |
<xsl:output method="xml" omit-xml-declaration="no" encoding="utf-8" indent="yes"/> |
36 |
|
37 |
|
38 |
|
39 |
<!-- Match root -->
|
40 |
|
41 |
<xsl:template match="/"> |
42 |
|
43 |
<wfs:Transaction service="WFS" version="1.0.0"> |
44 |
|
45 |
<xsl:apply-templates/>
|
46 |
|
47 |
</wfs:Transaction>
|
48 |
|
49 |
</xsl:template>
|
50 |
|
51 |
|
52 |
|
53 |
<!-- Match featureMember -->
|
54 |
|
55 |
<xsl:template match="gml:featureMember/*[@fid]"> |
56 |
|
57 |
<wfs:Update typeName="{name()}"> |
58 |
|
59 |
<ogc:Filter>
|
60 |
|
61 |
<ogc:FeatureId fid="{./@fid}"/> |
62 |
|
63 |
</ogc:Filter>
|
64 |
|
65 |
<xsl:for-each select="./*"> |
66 |
|
67 |
<wfs:Property>
|
68 |
|
69 |
<wfs:Name>
|
70 |
|
71 |
<xsl:value-of select="name()"/> |
72 |
|
73 |
</wfs:Name>
|
74 |
|
75 |
<wfs:Value>
|
76 |
|
77 |
<xsl:if test="./*"> |
78 |
|
79 |
<xsl:copy-of select="./*"/> |
80 |
|
81 |
</xsl:if>
|
82 |
|
83 |
<xsl:if test="not(./*)"> |
84 |
|
85 |
<xsl:value-of select="."/> |
86 |
|
87 |
</xsl:if>
|
88 |
|
89 |
</wfs:Value>
|
90 |
|
91 |
</wfs:Property>
|
92 |
|
93 |
</xsl:for-each>
|
94 |
|
95 |
</wfs:Update>
|
96 |
|
97 |
</xsl:template>
|
98 |
|
99 |
|
100 |
|
101 |
<xsl:template match="text()|@*"/> |
102 |
|
103 |
</xsl:stylesheet>
|
104 |
|