This seems pretty simple, but I'm missing to generate the required output. Any help would be appreciated.
Input XML:
<?xml version="1.0" encoding="UTF-8"?>
<Event xmlns="urn:sobject.partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Id>00Uc0000001iioEEAQ</Id>
<Subject>TestMeeting2</Subject>
<StartDateTime xsi:nil="true"/>
<Owner>
<Name>dev0044</Name>
<Email>testuser0044@gmail.com</Email>
</Owner>
<Notes_Universal_ID__c xsi:nil="true"/>
<Location>San Jose</Location>
<IsPrivate>false</IsPrivate>
<IsDeleted>false</IsDeleted>
<EndDateTime xsi:nil="true"/>
<Description>test description</Description>
<EventRelations>
<EventRelation>
<EventId>00Uc0000001iioEEAQ</EventId>
<RelationId>005c0000000T9YQAA0</RelationId>
<Relation>
<Email>testuser0045@gmail.com</Email>
</Relation>
</EventRelation>
<EventRelation>
<EventId>00Uc0000001iioEEAQ</EventId>
<RelationId>005c0000000T9YaAAK</RelationId>
<Relation>
<Email>testuser0047@gmail.com</Email>
</Relation>
</EventRelation>
</EventRelations>
Required Output XML:
<?xml version="1.0" encoding="UTF-8"?>
<CREATEAPPOINTMENT>
<STRUSERNAME>testuser0044</STRUSERNAME>
<STRSTARTDATETIME/>
<STRENDDATETIME/>
<STRSUBJECT>TestMeeting2</STRSUBJECT>
<STRDESCRIPTION>Email : testuser0045@gmail.com, testuser0047@gmail.com. Description: test description</STRDESCRIPTION>
<SRTLOCATION>San Jose</SRTLOCATION>
<STRPRIVATE>0</STRPRIVATE>
<STRAVAILABLE>0</STRAVAILABLE>
</CREATEAPPOINTMENT>
I'm able to get all except for the description field. The STRDESCRIPTION will contain a concatenation of EventRelations/EventRelation/Relation/Email (comma separated email addresses) and the actual Description field.
Here's the xsl that I'm trying with:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:sf="urn:partner.soap.sforce.com"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
<xsl:output indent="yes" method="xml"/>
<xsl:template match="*:Event">
<xsl:element name="CREATEAPPOINTMENT">
<xsl:element name="STRUSERNAME"><xsl:value-of select="*:Owner/*:Name"/></xsl:element>
<xsl:element name="STRSTARTDATETIME"><xsl:value-of select="*:StartDateTime"/></xsl:element>
<xsl:element name="STRENDDATETIME"><xsl:value-of select="*:EndDateTime"/></xsl:element>
<xsl:element name="STRSUBJECT"><xsl:value-of select="*:Subject"/></xsl:element>
<xsl:variable name="description" select="*:Description"/>
<xsl:element name="SRTDESCRIPTION">
<xsl:for-each select="*:EventRelations/*:EventRelation">
<xsl:variable name="email" select="*:Relation/*:Email"/>
<!-- <xsl:value-of select="concat('Email : ', $email, ' : Description : ')"></xsl:value-of> -->
<xsl:value-of select="$email"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="$description"></xsl:value-of>
<xsl:text>, </xsl:text>
</xsl:for-each>
</xsl:element>
<xsl:element name="SRTLOCATION"><xsl:value-of select="*:Location"/></xsl:element>
<xsl:choose>
<xsl:when test="*:IsPrivate = 'false'">
<xsl:element name="STRPRIVATE">0</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="STRPRIVATE">1</xsl:element>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="*:IsPrivate = 'false'">
<xsl:element name="STRAVAILABLE">0</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="STRAVAILABLE">1</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>