Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

How do I display correct output using xslt code

$
0
0

I would like to get correct output but my template is returning wrong output.
Correct output should be

<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

<EditReport><MessageIdentification>Case:1097</MessageIdentification><SourceLocation>111</SourceLocation><SourceUser>Tester</SourceUser><EditResult><EditNumber>001</EditNumber><ItemIdentification/><Result>Pass</Result></EditResult></EditReport>

xml document

<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

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 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>


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>