Please enable JavaScript to view this site.

Version:

As mentioned on the XSLT Transformation chapter, the VertiGIS Integrator comes with 6 predefined XSL stylesheets. For testing purposes you can modify the Copy.xsl file, found in the xsl folder under Project\Apache Tomcat\webapps\utpostserver\WEB-INF\, using the xsl template found on this page.

XSL stylesheet structure

Parameters

The paramaters are defined using: <xsl:param name="PARAMETER"/>.

Variables

Next, you have to define a list of variables. For our example we use GISLAYER, but for your own test case you have to replace:

VARIABLE_NAME: with a real variable name (e.g. GISLAYER).

VARIABLE_VALUE: with a value for this variable (e.g. NUMBER_OF_LAYER).

<xsl:variable name="VARIABLE_NAME">
<xsl:text>VARIABLE_VALUE</xsl:text>
</xsl:variable>

Placeholders

Under this section you have to add the placeholders, for example, the name of the feature service endpoint.

<xsl:comment>
  <xsl:text>uti.featureservice.endpoint=NAME_OF_FEATURE_SERVICE_ENDPOINT</xsl:text>
</xsl:comment>

Lookup functions

This part is used to look up for the external object and check if the feature already exists in the geodatabase.

select="fsapi:lookupVersionedValue('NAME_OF_FEATURE_SERVICE_ENDPOINT',$VERSION,$GISLAYER,'FIELD_NAME_OF_EXTERNAL_ID',FIELD_VALUE_OF_EXTERNAL_ID,'OBJECTID')"/>

 

Within the lookup function you have to replace the following terms with real values:

NAME_OF_FEATURE_SERVICE_ENDPOINT: name of the feature service that should be called for the look up.

$VERSION: the version (if we are working in a version).

$GISLAYER: inside the default version, we need to define a layer where we want to look up this OBJECTID.

FIELD_NAME_OF_EXTERNAL_ID:  a functional location key (e.g. SAP).

FIELD_VALUE_OF_EXTERNAL_ID: the external ID field value.

OBJECTID: the return value we want to get back from the look up, stored in the OBJECTID_IN_GIS variable.

For more information check out the Look up functions for registered database tables and the Lookup functions fot the unregistered database tables topics.

Features

Under the applyEditsRequest line, you can add a list of features that should be inserted, updated or deleted in the geodatabase. When this applyEditsRequest is sent to the ArcGIS Server, this feature is inserted or updated in the correct layer.

<applyEditsRequest>
<!-- list of features -->
<features>
 <feature>
  <layerId>
   <xsl:value-of select="$GISLAYER"/>
  </layerId>

Operations

In this part, we decide if the operation is an Update (U) or an Insert (I):

Insert (I): if the OBJECTID_IN_GIS is empty.

Update (U): if the OBJECTID_IN_GIS is not empty.

<xsl:choose>
 <xsl:when test="$OBJECTID_IN_GIS != ''">
  <operation>U</operation>
   </xsl:when>
  <xsl:otherwise>
       <operation>I</operation>
 </xsl:otherwise>
</xsl:choose>

Attributes

Within the feature section, you can add a list of attributes that should be inserted or updated in this feature. If there is an update we also have to define the OBJECTID_IN_GIS as an attribute to reproduce the Operations scenario: if the OBJECTID_IN_GIS already exists, the OBJECTID must be updated, otherwise insert it.  This feature request needs an OBJECTID for an update (in other scenarios it can also be a GLOBALID).

<attributes>
<xsl:if test="$OBJECTID_IN_GIS != ''">
 <attribute key='OBJECTID'>
   <xsl:value-of select="$OBJECTID_IN_GIS"/>
</attribute>

Attribute key

Afterward, you have to add a field name list. The field name list may vary in length, depending on what you want to write on this feature from the external system.

As an example, VertiGIS Integrator receives from SAP information about a station containing the function location key, name, and type, which we must add as attributes on this list.

<attribute key='FIELD_NAME1'>
<xsl:value-of select="FIELD_VALUE1"/>
</attribute>

For your own test, you must replace with real values:

FIELD_NAME1: the name of the field  (e.g. 'INSTALLATIONYEAR').

FIELD_VALUE1: a value we want to write in this field (e.g. YEAR).

The field types are defined in the layer metadata, found in ArcGIS Services (e.g. Home > services > Berlin_postgres_123 > Berlin_postgres_123 (FeatureServer) > ELEAssembly). Use uppercase for the fields. A few examples can be seen in the picture below.

layer_fields

In our example, to set the installationyear field:

added the year attribute.

selected the YEAR from the incoming XML (when SAP sends a message from XML,  is called YEAR on SAP side).

defined the year as a fixed value using <xsl:text>.

 

The result:

<attribute key='INSTALLATIONYEAR'>
  <xsl:value-of select="//YEAR"/>
  <xsl:text>2024</xsl:text>
</attribute>

Geometry

Geometry is required in order to add a feature to the geodatabase. VertiGIS Integrator supports 3 types of features with their own specific geometry:

point

polyline

polygon

Select the geometry type based on the layer description (visible in the Geometry Type line). The geometry types are defined in the layer metadata, found in ArcGIS Services (e.g. Home > services > Berlin_postgres_123 > Berlin_postgres_123 (FeatureServer) > ELEAssembly).

The layer has only one type of geometry at once. When you add the geometry, make sure you added the one matching layer's Geometry Type.

Geometry examples:

Point feature geometry:

<geometry>
<format>XML</format>
  <x>390452.1528000012</x>
  <y>5820230.3950999975</y>
</geometry>

 

Poly line feature geometry:

<geometry>
<format>XML</format>
 <paths>
  <item>
   <item>389965.75829999894</item>
   <item>5820589.075800002</item>
  </item>
 <item>
  <item>389966.2432000004</item>
  <item>5820588.323100001</item>
 </item>
 <item>
  <item>389967.6239</item>
  <item>5820586.18</item>
 </item>
</paths>
</geometry>

 

Polygon defined by rings feature geometry:

<geometry>
<format>XML</format>
<rings>
<item>
 <item>390542.22679999843</item>
 <item>5820318.094300002</item>
</item>
<item>
 <item>390541.2067999989</item>
 <item>5820318.094300002</item>
</item>
<item>
 <item>390541.2067999989</item>
 <item>5820319.114299998</item>
</item>
<item>
 <item>390542.22679999843</item>
 <item>5820319.114299998</item>
</item>
<item>
 <item>390542.22679999843</item>
 <item>5820318.094300002</item>
</item>
</rings>
</geometry>

To create your own XSL stylesheet:

in Windows Explorer, open the Project\Apache Tomcat\webapps\utpostserver\WEB-INF\xsl folder.

create a backup copy of the Copy.xsl file.

using Notepad++ (or a similar tool), open the Copy.xsl file.

paste the template below.

you can run it as it is or make further modifications.

save the file.

 

XSL stylesheet template

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
               xmlns:java="http://xml.apache.org/xalan/java"
               xmlns:xalan="http://xml.apache.org/xalan"
               exclude-result-prefixes="java xalan"
               xmlns:n0="http://soap.postserver.aedsicad.com/uti.xsd"
               xmlns:utiapi="com.aedsicad.postserver.api.XSLHelper"
               xmlns:fsapi="com.aedsicad.postserver.api.XSLFeatureServiceAPI"
               xmlns:stringutil="org.apache.commons.lang3.StringUtils"
               xmlns:xs="http://www.w3.org/2001/XMLSchema"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <xsl:param name="STANDALONE"/>
  <xsl:param name="VERSION"/>
  <xsl:param name="MESSAGE_ID"/>
  <xsl:param name="FS_ENDPOINT"/>
  <xsl:template match="/">
     <xsl:comment>
        <xsl:text>uti.featureservice.endpoint=NAME_OF_FEATURE_SERVICE_ENDPOINT</xsl:text>
     </xsl:comment>
     <xsl:variable name="GISLAYER">
        <xsl:text>NUMBER_OF_LAYER</xsl:text>
     </xsl:variable>
     <xsl:variable name="OBJECTID_IN_GIS"
                   select="fsapi:lookupVersionedValue('NAME_OF_FEATURE_SERVICE_ENDPOINT',$VERSION,$GISLAYER,'FIELD_NAME_OF_EXTERNAL_ID',FIELD_VALUE_OF_EXTERNAL_ID,'OBJECTID')"/>
     <restRequest>
        <applyEditsRequest>
           <!-- list of features -->
           <features>
              <feature>
                 <layerId>
                    <xsl:value-of select="$GISLAYER"/>
                 </layerId>
                 <xsl:choose>
                    <xsl:when test="$OBJECTID_IN_GIS != ''">
                       <operation>U</operation>
                    </xsl:when>
                    <xsl:otherwise>
                       <operation>I</operation>
                    </xsl:otherwise>
                 </xsl:choose>
                 <attributes>
                    <xsl:if test="$OBJECTID_IN_GIS != ''">
                       <attribute key='OBJECTID'>
                          <xsl:value-of select="$OBJECTID_IN_GIS"/>
                       </attribute>
                    </xsl:if>
                    <attribute key='FIELD_NAME1'>
                       <xsl:value-of select="FIELD_VALUE1"/>
                    </attribute>
                    <attribute key='FIELD_NAME2'>
                       <xsl:value-of select="FIELD_VALUE2"/>
                    </attribute>
                    <attribute key='INSTALLATIONYEAR'>
                       <xsl:value-of select="//YEAR"/>
                       <xsl:text>2024</xsl:text>
                    </attribute>
                 </attributes>
                 <geometry>
                    <format>XML</format>
                    <x>390452.1528000012</x>
                    <y>5820230.3950999975</y>
                 </geometry>
              </feature>
              <feature>
              </feature>
           </features>
        </applyEditsRequest>
     </restRequest>
  </xsl:template>
</xsl:stylesheet>

© 2024 VertiGIS GmbH. All Rights Reserved. | Privacy Center | Imprint
Documentation Version 10.0 (fa3b2a93)