#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2016
    Posts
    16
    Rep Power
    0

    How do I output several notification?


    I am using a template to output NotificationEvent. My xml has 2 NotificationEvents. The problem is that I am not getting correct output

    Expected output
    Code:
    <IntegrationConditions>
    	<IntegrationCondition Word="CASEDETAIL" Description="CaseDetail/Security">
    		<NotificationEvent notificationType="CaseDetailsNotification" elementState="Existing" elementName="Case" elementKey="14886023">CaseTitleModified</NotificationEvent>
    	</IntegrationCondition>
    	<IntegrationCondition Word="SUBPARTY" Description="SubjectParty">
    		<NotificationEvent notificationType="SubjectPartyNotification" elementState="Existing" elementName="CaseRespondent" elementKey="18118912">SubjectPartyNameAdded</NotificationEvent>
    	</IntegrationCondition>
    </IntegrationConditions>
    xml document
    Code:
    <Integration>
    	<ControlPoint>SAVE-FAM-CASE</ControlPoint>
    	<Case ID="14886023" Op="E" xmlns:user="http://tylertechnologies.com">
    		<CaseCategory>FAM</CaseCategory>
    		<CaseType Word="DMA">Domestic Abuse</CaseType>
    		<BaseCaseType>Civil Domestic Violence</BaseCaseType>
    		<CaseTitle Op="E">In the Matter</CaseTitle>
    		<CaseNumber>370</CaseNumber>
    
    
    		<CaseParty Op="E" ID="18118912" InternalCasePartyID="1649118185" InternalPartyID="1617896624">
    			<Connection Word="RSP" BaseConnection="DF" ID="44925838" InternalCasePartyConnectionID="1651131186">
    				<Description>Respondent</Description>
    			</Connection>
    			<CasePartyName ID="12124296" InternalNameID="1618924116">
    				<NameFirst>SILLY</NameFirst>
    				<NameLast>SOLLY</NameLast>
    				<FormattedName>SOLLY, SILLY</FormattedName>
    			</CasePartyName>
    			<CasePartyName Op="A" Current="true" ID="12124639" InternalNameID="1618924395">
    				<CasePartyNameType Op="A" Word=""/>
    				<NameMiddle>Soo</NameMiddle>
    				<FormattedName>Solly, Silly Soo</FormattedName>
    			</CasePartyName>
    		</CaseParty>
              </Case>
    	<IntegrationConditions>
    		<IntegrationCondition Word="CASEDETAIL" Description="CaseDetail/Security">
    			<NotificationEvent notificationType="CaseDetailsNotification" elementState="Existing" elementName="Case" elementKey="14886023">CaseTitleModified</NotificationEvent>
    		</IntegrationCondition>
    		<IntegrationCondition Word="SUBPARTY" Description="SubjectParty">
    			<NotificationEvent notificationType="SubjectPartyNotification" elementState="Existing" elementName="CaseRespondent" elementKey="18118912">SubjectPartyNameAdded</NotificationEvent>
    		</IntegrationCondition>
    	</IntegrationConditions>
    </Integration>
    My xslt template code
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet>
    	<xsl:template name="CaseDetailsNotification">
    		<xsl:if test="Integration/ControlPoint='SAVE-FAM-CASE'">
    			<xsl:if test="Integration/Case/CaseType/@Word='DMA'">
    				<xsl:for-each select="Integration/Case[@Op='E']">/Integration/IntegrationConditions/IntegrationCondition[2]/NotificationEvent/@notificationType
    				<NotificationEvent notificationType="CaseDetailsNotification">
    						<xsl:attribute name="elementState"><xsl:value-of select="/Integration/IntegrationConditions/IntegrationCondition/NotificationEvent/@elementState"/></xsl:attribute>
    						<xsl:attribute name="elementName"><xsl:value-of select="/Integration/IntegrationConditions/IntegrationCondition/NotificationEvent/@elementName"/></xsl:attribute>
    						<xsl:attribute name="elementKey"><xsl:value-of select="/Integration/IntegrationConditions/IntegrationCondition/NotificationEvent/@elementKey"/></xsl:attribute>
    						<xsl:choose>
    							<xsl:when test="/Integration/Case/@Op='E'">CaseTitleModified</xsl:when>
    						</xsl:choose>
    					</NotificationEvent>
    				</xsl:for-each>
    			</xsl:if>
    		</xsl:if>
    		<!-- Check PartyName change-->
    		<xsl:if test="Integration/Case/CaseType/@Word='DMA'">
    			<xsl:for-each select="/Integration/Case/CaseParty[@Op='E']">
    				<NotificationEvent notificationType="CaseDetailsNotification">
    					<xsl:attribute name="elementState"><xsl:value-of select="/Integration/IntegrationConditions/IntegrationCondition/NotificationEvent/@elementState"/></xsl:attribute>
    					<xsl:attribute name="elementName"><xsl:value-of select="/Integration/IntegrationConditions/IntegrationCondition/NotificationEvent/@elementName"/></xsl:attribute>
    					<xsl:attribute name="elementKey"><xsl:value-of select="/Integration/IntegrationConditions/IntegrationCondition/NotificationEvent/@elementKey"/></xsl:attribute>
    					<xsl:choose>
    						<xsl:when test="/Integration/Case/CaseParty/@Op='E'">SubjectPartyNameAdded</xsl:when>
    					</xsl:choose>
    				</NotificationEvent>
    			</xsl:for-each>
    		</xsl:if>
    	</xsl:template>
    </xsl:stylesheet>
    My xslt template is producing the following output which is not right.
    Each NotificationEvent has different notificationType, elementState, elementName, elementKey.

    Wrong output
    Code:
    <NotificationEvent notificationType="CaseDetailsNotification" elementState="Existing" elementName="Case" elementKey="14886023" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">CaseTitleModified</NotificationEvent>
    <NotificationEvent notificationType="CaseDetailsNotification" elementState="Existing" elementName="Case" elementKey="14886023" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">SubjectPartyNameAdded</NotificationEvent>
    Last edited by okaymy1112; October 6th, 2016 at 09:40 AM. Reason: I added closing tag for Case
  2. #2
  3. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,384
    Rep Power
    9645
    1. Your expected output is just a copy of the <IntegrationConditions>? And the XML is malformed - missing a </Case>.
    2. What's the actual output?
    3. Looks like that XSLT isn't the complete version...
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2016
    Posts
    16
    Rep Power
    0
    I added the closing tag for case </Case>
    And yes that is output I want to replicate and my output is not getting the correct attributes.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2016
    Posts
    16
    Rep Power
    0
    I no longer need help for this. Thanks

IMN logo majestic logo threadwatch logo seochat tools logo