Sample XSLT transformation and XSD schema
Dette indhold er ikke tilgængeligt i dit sprog endnu.
On this page, you can copy or download the XSLT and XSD files that are required to configure an Interact+ service workflow. The sample files below are the default XSLT and XSD files.
XSLT transformation
Section titled “XSLT transformation”An XSLT transformation is required for the Interact+ connector service workflow to retrieve Interact+ data from a custom XML format.
Example
Section titled “Example”<!-- XSLT transformation to transform step element into entities --><xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ms="urn:schemas-microsoft-com:xslt"
> <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/"> <xsl:if test="dialogue"> <Interact_Out> <xsl:attribute name="Reference_Number"> <xsl:value-of select="dialogue/reference" /> </xsl:attribute> <Entities> <xsl:apply-templates select="dialogue/step[@id = 'WZ_ODATA']/group[@id != 'RecordTemplate']"/> </Entities> <RecordTemplate> <xsl:apply-templates select="dialogue/step[@id = 'WZ_ODATA']/group[@id = 'RecordTemplate']"/> </RecordTemplate> <AdditionalData/> </Interact_Out> </xsl:if> </xsl:template>
<xsl:template match="group[@id != 'RecordTemplate']"> <xsl:if test="@id != 'RecordTemplate'"> <Entity> <xsl:if test=". != ''"> <xsl:attribute name="EntitySet"> <xsl:if test="starts-with(@label,'Objects_')">
<xsl:variable name="lastIndex"> <xsl:call-template name="last-index-of"> <xsl:with-param name="txt" select="@label"/> <xsl:with-param name="delimiter" select="'_'"></xsl:with-param> </xsl:call-template> </xsl:variable> <xsl:text>Objects/Som.Custom.</xsl:text> <xsl:value-of select="substring(@label, $lastIndex+1, 50)"/> </xsl:if> <xsl:if test="not(starts-with(@label,'Objects_')) and contains(@label,'Int64')"> <xsl:value-of select="substring-before(@label,'Int64')" /> <xsl:text>Int64</xsl:text> <xsl:value-of select="translate(substring-after(@label,'Int64'),'012345789','')" /> </xsl:if> <xsl:if test="not(starts-with(@label,'Objects_')) and not(contains(@label,'Int64'))"> <xsl:value-of select="translate(@label,'0123456789','')" /> </xsl:if> </xsl:attribute> <xsl:attribute name="Id"> <xsl:value-of select="@id" /> </xsl:attribute> <xsl:apply-templates select="element"/> </xsl:if> <xsl:apply-templates select="group[@id = 'References']"/> </Entity> </xsl:if> </xsl:template>
<xsl:template match="group[@id != 'RecordTemplate']/group[@id = 'References']"> <xsl:if test="@id = 'References'"> <xsl:apply-templates select="element"/> </xsl:if> </xsl:template>
<xsl:template match="group[@id = 'RecordTemplate']"> <xsl:if test="@id = 'RecordTemplate'"> <xsl:apply-templates select="element"/> <xsl:apply-templates select="group[@id = 'References']"/> </xsl:if> </xsl:template>
<xsl:template match="group[@id = 'RecordTemplate']/group[@id = 'References']"> <xsl:if test="@id = 'References'"> <xsl:apply-templates select="element"/> </xsl:if> </xsl:template>
<xsl:template match="element"> <xsl:if test=". != ''"> <Property> <xsl:attribute name="Name"> <xsl:value-of select="@label" /> </xsl:attribute>
<xsl:attribute name="Type"> <xsl:choose> <xsl:when test="starts-with(.,'{')">json</xsl:when> <xsl:when test="@type='string'">string</xsl:when> <xsl:when test="@type='date'">datetime</xsl:when> <xsl:when test="@type='dateTime'">datetime</xsl:when> <xsl:when test="@type='integer'">int</xsl:when> <xsl:when test="@type='boolean'">boolean</xsl:when> <xsl:when test="@type='decimal'">string</xsl:when> <xsl:when test="@type='int'">string</xsl:when> </xsl:choose> </xsl:attribute> <xsl:value-of select="."/> </Property> </xsl:if> </xsl:template>
<xsl:template match="element[@label='File']|element[@label='Name']|element[@label='Records']"> <xsl:if test=". != ''"> <EntityRef> <xsl:attribute name="Name"> <xsl:value-of select="@label" /> </xsl:attribute> <xsl:attribute name="IdRef"> <xsl:value-of select="."/> </xsl:attribute> </EntityRef > </xsl:if> </xsl:template>
<!--Source - https://stackoverflow.com/aPosted by Mads Hansen, modified by community. See post 'Timeline' for change historyRetrieved 2026-01-22, License - CC BY-SA 3.0-->
<xsl:template name="last-index-of"> <xsl:param name="txt"/> <xsl:param name="remainder" select="$txt"/> <xsl:param name="delimiter" select="' '"/>
<xsl:choose> <xsl:when test="contains($remainder, $delimiter)"> <xsl:call-template name="last-index-of"> <xsl:with-param name="txt" select="$txt"/> <xsl:with-param name="remainder" select="substring-after($remainder, $delimiter)"/> <xsl:with-param name="delimiter" select="$delimiter"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:variable name="lastIndex" select="string-length(substring($txt, 1, string-length($txt)-string-length($remainder)))+1"/> <xsl:choose> <xsl:when test="string-length($remainder)=0"> <xsl:value-of select="string-length($txt)"/> </xsl:when> <xsl:when test="$lastIndex>0"> <xsl:value-of select="($lastIndex - string-length($delimiter))"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="0"/> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template>
</xsl:stylesheet>XSD schema
Section titled “XSD schema”You can use an XSD schema to validate the retrieved custom XML format and improve the readability possible error messages.
Example
Section titled “Example”<?xml version="1.0" encoding="utf-8"?><xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="dialogue"> <xs:complexType> <xs:sequence> <xs:element name="id" type="xs:string" /> <xs:element name="name" type="xs:string" /> <xs:element name="reference" type="xs:string" /> <xs:element name="step"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="group"> <xs:complexType> <xs:sequence> <xs:choice maxOccurs="unbounded"> <xs:element maxOccurs="unbounded" name="element"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="id" type="xs:string" use="required" /> <xs:attribute name="label" type="xs:string" use="required" /> <xs:attribute name="type" type="xs:string" use="required" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element name="group"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="element"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="id" type="xs:string" use="required" /> <xs:attribute name="label" type="xs:string" use="required" /> <xs:attribute name="type" type="xs:string" use="required" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="id" type="xs:string" use="required" /> <xs:attribute name="label" type="xs:string" use="required" /> </xs:complexType> </xs:element> </xs:choice> </xs:sequence> <xs:attribute name="id" type="xs:string" use="required" /> <xs:attribute name="label" type="xs:string" use="required" /> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="id" type="xs:string" use="required" /> <xs:attribute name="label" type="xs:string" use="required" /> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element></xs:schema>
