I would like to get correct output but my template is returning wrong output.
Correct output should be
I am getting the following output which is wrong because Result node should say Fail
xml document
xslt code
Correct output should be
XML:
<EditReport>
<MessageIdentification>Case:1097</MessageIdentification>
<SourceLocation>111</SourceLocation>
<SourceUser>Tester</SourceUser>
<EditResult>
<EditNumber>001</EditNumber>
<ItemIdentification/>
<Result>Fail</Result>
</EditResult>
</EditReport>
I am getting the following output which is wrong because Result node should say Fail
XML:
<EditReport>
<MessageIdentification>Case:1097</MessageIdentification>
<SourceLocation>111</SourceLocation>
<SourceUser>Tester</SourceUser>
<EditResult>
<EditNumber>001</EditNumber>
<ItemIdentification/>
<Result>Pass</Result>
</EditResult>
</EditReport>
xml document
XML:
<Integration>
<ControlPoint Timestamp="10/13/2016 11:00:15 AM" UserID="Tester"/>
<Case>
<CaseNumber>1097</CaseNumber>
<Court>
<NodeID>111</NodeID>
</Court>
</Case>
<IntegrationConditions>
<NotificationEvent notificationType="CasePartyUpdates">CasePartyUpdate</NotificationEvent>
</IntegrationConditions>
</Integration>
xslt code
Code:
<xsl:stylesheet xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform"[/URL] xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0">
<xsl:output method="xml"/>
<xsl:variable name="gEditPass">Pass</xsl:variable>
<xsl:variable name="gEditFail">Fail</xsl:variable>
<xsl:variable name="gMessageIdentification">Case:<xsl:value-of select="Integration/Case/CaseNumber"/>
</xsl:variable>
<xsl:template match="/">
<EditReport>
<MessageIdentification>
<xsl:value-of select="$gMessageIdentification"/>
</MessageIdentification>
<SourceLocation>
<xsl:value-of select="Integration/Case/Court/NodeID"/>
</SourceLocation>
<SourceUser>
<xsl:value-of select="Integration/ControlPoint/@UserID"/>
</SourceUser>
<!-- Edit number 001 -->
<xsl:call-template name="EditPartyUpdate"/>
</EditReport>
</xsl:template>
<!-- E D I T N U M B E R 001 -->
<xsl:template name="EditPartyUpdate">
<xsl:variable name="vPOSendEventCount">
<xsl:value-of select="count(NotificationEvent[(@notificationType='ProtectionOrder') or (@notificationType='ProtectionOrderInactivation')])>0"/>
</xsl:variable>
<xsl:variable name="vPartyUpdateEventCount">
<xsl:value-of select="count(NotificationEvent[@notificationType='CasePartyUpdates'])>0"/>
</xsl:variable>
<xsl:for-each select="Integration/IntegrationConditions/IntegrationCondition/NotificationEvent">
<EditResult>
<EditNumber>001</EditNumber>
<ItemIdentification>
</ItemIdentification>
<Result>
<xsl:choose>
<xsl:when test="$vPartyUpdateEventCount=0">
<xsl:value-of select="$gEditFail"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$gEditPass"/>
</xsl:otherwise>
</xsl:choose>
</Result>
</EditResult>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>