| 1 |
<?xml version="1.0"?> |
| 2 |
<xsl:stylesheet version="1.0" |
| 3 |
xmlns:ca="urn:ietf:params:xml:ns:pidf:geopriv10:civicAddr" |
| 4 |
xmlns:def="urn:ietf:params:xml:ns:pidf" |
| 5 |
xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" |
| 6 |
xmlns:fn="http://www.w3.org/2005/xpath-functions" |
| 7 |
xmlns:gbp="urn:ietf:params:xml:ns:pidf:geopriv10:basicPolicy" |
| 8 |
xmlns:gml="http://www.opengis.net/gml" |
| 9 |
xmlns:gp="urn:ietf:params:xml:ns:pidf:geopriv10" |
| 10 |
xmlns:gs="http://www.opengis.net/pidflo/1.0" |
| 11 |
xmlns:con="urn:ietf:params:xml:ns:geopriv:conf" |
| 12 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
<xsl:output method="xml" indent="yes"/> |
| 44 |
<xsl:strip-space elements="*"/> |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
<xsl:template match="/def:presence"> |
| 53 |
<xsl:element name="presence"> |
| 54 |
<xsl:attribute name="entity"><xsl:value-of select="@entity"/></xsl:attribute> |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
<xsl:apply-templates select="dm:device[./gp:geopriv/gp:location-info]"/> |
| 60 |
<xsl:apply-templates select="def:tuple[./def:status/gp:geopriv/gp:location-info]"/> |
| 61 |
<xsl:apply-templates select="dm:person[.//gp:geopriv/gp:location-info]"/> |
| 62 |
</xsl:element> |
| 63 |
</xsl:template> |
| 64 |
|
| 65 |
<xsl:template name="geopriv"> |
| 66 |
<xsl:apply-templates select=".//gp:geopriv/gp:location-info"/> |
| 67 |
<xsl:apply-templates select=".//gp:geopriv/gp:usage-rules"/> |
| 68 |
<xsl:apply-templates select=".//gp:geopriv/gp:method"/> |
| 69 |
<xsl:apply-templates select=".//gp:geopriv/gp:note-well"/> |
| 70 |
</xsl:template> |
| 71 |
|
| 72 |
<xsl:template match="def:tuple"> |
| 73 |
<xsl:element name="tuple"> |
| 74 |
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> |
| 75 |
<xsl:call-template name="geopriv"/> |
| 76 |
<xsl:apply-templates select="./def:timestamp"/> |
| 77 |
<xsl:if test="./dm:deviceID"> |
| 78 |
<deviceID> |
| 79 |
<xsl:value-of select="./dm:deviceID"/> |
| 80 |
</deviceID> |
| 81 |
</xsl:if> |
| 82 |
</xsl:element> |
| 83 |
</xsl:template> |
| 84 |
|
| 85 |
<xsl:template match="dm:device|dm:person"> |
| 86 |
<xsl:element name="{local-name(.)}"> |
| 87 |
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> |
| 88 |
<xsl:call-template name="geopriv"/> |
| 89 |
<xsl:apply-templates select="./dm:timestamp"/> |
| 90 |
<xsl:if test="./dm:deviceID"> |
| 91 |
<deviceID> |
| 92 |
<xsl:value-of select="./dm:deviceID"/> |
| 93 |
</deviceID> |
| 94 |
</xsl:if> |
| 95 |
</xsl:element> |
| 96 |
</xsl:template> |
| 97 |
|
| 98 |
<xsl:template match="gp:geopriv/gp:location-info"> |
| 99 |
<xsl:element name="location-info"> |
| 100 |
<xsl:choose> |
| 101 |
<xsl:when test="ca:civicAddress"> |
| 102 |
<xsl:attribute name="format">civicAddress</xsl:attribute> |
| 103 |
</xsl:when> |
| 104 |
<xsl:when test="gml:*"> |
| 105 |
<xsl:attribute name="format">gml</xsl:attribute> |
| 106 |
</xsl:when> |
| 107 |
<xsl:when test="gs:*"> |
| 108 |
<xsl:attribute name="format">gml</xsl:attribute> |
| 109 |
</xsl:when> |
| 110 |
</xsl:choose> |
| 111 |
<xsl:apply-templates/> |
| 112 |
</xsl:element> |
| 113 |
</xsl:template> |
| 114 |
|
| 115 |
|
| 116 |
<xsl:template match="gp:location-info/ca:civicAddress"> |
| 117 |
<xsl:element name="civicAddress"> |
| 118 |
<xsl:attribute name="lang"><xsl:value-of select="@xml:lang"/></xsl:attribute> |
| 119 |
|
| 120 |
<xsl:for-each select="./*"> |
| 121 |
<xsl:call-template name="name-value" /> |
| 122 |
</xsl:for-each> |
| 123 |
</xsl:element> |
| 124 |
</xsl:template> |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
<xsl:template match="gp:location-info/gml:*|gp:location-info/gs:*"> |
| 130 |
<xsl:element name="{local-name(.)}"> |
| 131 |
<xsl:choose> |
| 132 |
<xsl:when test="@srsName = 'urn:ogc:def:crs:EPSG::4326'"> |
| 133 |
<xsl:attribute name="srsName">2d</xsl:attribute> |
| 134 |
</xsl:when> |
| 135 |
<xsl:when test="@srsName = 'urn:ogc:def:crs:EPSG::4979'"> |
| 136 |
<xsl:attribute name="srsName">3d</xsl:attribute> |
| 137 |
</xsl:when> |
| 138 |
<xsl:otherwise> |
| 139 |
<xsl:attribute name="srsName">unknown</xsl:attribute> |
| 140 |
</xsl:otherwise> |
| 141 |
</xsl:choose> |
| 142 |
<xsl:apply-templates /> |
| 143 |
</xsl:element> |
| 144 |
</xsl:template> |
| 145 |
|
| 146 |
|
| 147 |
<xsl:template match="gs:orientation"><xsl:call-template name="angle" /></xsl:template> |
| 148 |
<xsl:template match="gs:radius"><xsl:call-template name="length" /></xsl:template> |
| 149 |
<xsl:template match="gs:height"><xsl:call-template name="length" /></xsl:template> |
| 150 |
<xsl:template match="gs:semiMajorAxis"><xsl:call-template name="length" /></xsl:template> |
| 151 |
<xsl:template match="gs:semiMinorAxis"><xsl:call-template name="length" /></xsl:template> |
| 152 |
<xsl:template match="gs:verticalAxis"><xsl:call-template name="length" /></xsl:template> |
| 153 |
<xsl:template match="gs:innerRadius"><xsl:call-template name="length" /></xsl:template> |
| 154 |
<xsl:template match="gs:outerRadius"><xsl:call-template name="length" /></xsl:template> |
| 155 |
<xsl:template match="gs:startAngle"><xsl:call-template name="angle" /></xsl:template> |
| 156 |
<xsl:template match="gs:openingAngle"><xsl:call-template name="angle" /></xsl:template> |
| 157 |
<xsl:template match="gml:pos"><xsl:call-template name="name-value" /></xsl:template> |
| 158 |
<xsl:template match="gml:posList"><xsl:call-template name="name-value" /></xsl:template> |
| 159 |
|
| 160 |
|
| 161 |
<xsl:template name="name-value"> |
| 162 |
<xsl:element name="{local-name(.)}"> |
| 163 |
<xsl:value-of select="normalize-space(.)"/> |
| 164 |
</xsl:element> |
| 165 |
</xsl:template> |
| 166 |
|
| 167 |
<xsl:template name="length"><xsl:call-template name="name-value" /></xsl:template> |
| 168 |
|
| 169 |
<xsl:template name="angle"> |
| 170 |
<xsl:element name="{local-name(.)}"> |
| 171 |
<xsl:choose> |
| 172 |
<xsl:when test="@uom = 'urn:ogc:def:uom:EPSG::9101'"> |
| 173 |
<xsl:attribute name="uom">radians</xsl:attribute></xsl:when> |
| 174 |
<xsl:otherwise> |
| 175 |
<xsl:attribute name="uom">degrees</xsl:attribute></xsl:otherwise> |
| 176 |
</xsl:choose> |
| 177 |
<xsl:value-of select="normalize-space(.)"/> |
| 178 |
</xsl:element> |
| 179 |
</xsl:template> |
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
<xsl:template match="gp:location-info/con:confidence"> |
| 184 |
<xsl:element name="{local-name(.)}"> |
| 185 |
<xsl:attribute name="pdf"><xsl:value-of select="@pdf"/></xsl:attribute> |
| 186 |
<xsl:value-of select="normalize-space(.)" /> |
| 187 |
</xsl:element> |
| 188 |
</xsl:template> |
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
<xsl:template match="gp:geopriv/gp:usage-rules"> |
| 193 |
<xsl:element name="usage-rules"> |
| 194 |
<xsl:for-each select="./*"> |
| 195 |
<xsl:call-template name="name-value" /> |
| 196 |
</xsl:for-each> |
| 197 |
</xsl:element> |
| 198 |
</xsl:template> |
| 199 |
|
| 200 |
<xsl:template match="gp:geopriv/gp:method"> |
| 201 |
<xsl:call-template name="name-value" /> |
| 202 |
</xsl:template> |
| 203 |
|
| 204 |
<xsl:template match="gp:geopriv/gp:note-well"> |
| 205 |
<xsl:element name="note-well"> |
| 206 |
<xsl:value-of select="." /> |
| 207 |
</xsl:element> |
| 208 |
</xsl:template> |
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
<xsl:template match="def:timestamp|dm:timestamp"> |
| 213 |
<xsl:call-template name="name-value" /> |
| 214 |
</xsl:template> |
| 215 |
|
| 216 |
|
| 217 |
</xsl:stylesheet> |