I need help to add a condition for all notification events,. So that all notification events have the Hearing Type code must be ACT HearingType/@ Word = 'ACT' How do I do this in my xslt? I have reduced the xslt code.
When I run xlm code through xslt I am getting the following output which is wrong. The output is wrong because
HearingType/@ Word = 'ACT' is not true. I should get no output at all.
Because <HearingType Op="A" Word="HGO">Hearing Officer Appointment</HearingType> output should be nothing.
Output which is wrong
Code:
<NotificationEvent notificationType="PrepareHearingDocument" elementState="New" elementName="Hearing" elementKey="252919460">HearingScheduled</NotificationEvent>
Output should only be shown when HearingType/@ Word = 'ACT' .
Xml document that I run through xslt
Code:
<?xml version="1.0" encoding="UTF-8"?>
<Integration>
<Case xmlns:user="http://tylertechnologies.com" InternalID="1625028718" ID="18477565">
<Hearing xmlns:reslib="urn:reslib" ID="252919460" InternalHearingEventID="1851128069" Op="A">
<HearingType Op="A" Word="HGO">Hearing Officer Appointment</HearingType><!--HearingType/@Word-->
<Setting ID="32178675" InternalSettingID="1631575987" Date="01/22/2019" Op="A">
<HearingDate Op="A">01/22/2019</HearingDate>
</Setting>
</Hearing>
</Case>
<IntegrationConditions>
<IntegrationCondition Word="HRGTRLSET" Description="HearingTrialSetting">
<NotificationEvent notificationType="PrepareHearingDocument" elementState="New" elementName="Hearing" elementKey="252919460">HearingScheduled</NotificationEvent>
</IntegrationCondition>
</IntegrationConditions>
</Integration>
My xlst code
Code:
<?xml version="1.0" encoding="UTF-8"?>
<?altova_samplexml file:///Z:/Most%20things%20here/LeeAnn%20projects/Release%2064/HearingScheduled2.xml?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="Integration/Case/Hearing"/>
</xsl:template>
<xsl:template match="Hearing">
<!-- Set variable for Hearing ID -->
<xsl:variable name="vID">
<!--Get Hearing ID-->
<xsl:value-of select="@ID"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="(@Op='A') and (HearingType/@Op='A')">
<NotificationEvent notificationType="PrepareHearingDocument">
<xsl:attribute name="elementState">New</xsl:attribute>
<xsl:attribute name="elementName">Hearing</xsl:attribute>
<xsl:attribute name="elementKey"><xsl:value-of select="$vID"/><!--Get ID equal to ID from Hearing--></xsl:attribute>
<xsl:text>HearingScheduled</xsl:text>
</NotificationEvent>
</xsl:when>
<xsl:when test="(@Op='E') and (string-length(CancelledReason)!=0) and (CancelledReason/@Op='E')">
<NotificationEvent notificationType="PrepareHearingDocument">
<xsl:attribute name="elementState">New</xsl:attribute>
<xsl:attribute name="elementName">Hearing</xsl:attribute>
<xsl:attribute name="elementKey"><xsl:value-of select="$vID"/></xsl:attribute>
<xsl:text>HearingCancelled</xsl:text>
</NotificationEvent>
</xsl:when>
<!--HearingCancelled-->
<xsl:otherwise>
<xsl:if test="(HearingType/@Op='E')">
<NotificationEvent notificationType="PrepareHearingDocument">
<xsl:attribute name="elementState">New</xsl:attribute>
<xsl:attribute name="elementName">Hearing</xsl:attribute>
<xsl:attribute name="elementKey"><xsl:value-of select="$vID"/></xsl:attribute>
<xsl:text>HearingModified</xsl:text>
</NotificationEvent>
</xsl:if>
<!--HearingModified-->
<xsl:for-each select="Setting[@Op='A']">
<NotificationEvent notificationType="PrepareHearingDocument">
<xsl:attribute name="elementState">New</xsl:attribute>
<xsl:attribute name="elementName">Setting</xsl:attribute>
<xsl:attribute name="elementKey"><xsl:value-of select="$vID"/></xsl:attribute>
<xsl:attribute name="subElementKey"><xsl:value-of select="@ID"/></xsl:attribute>
<xsl:text>SettingScheduled</xsl:text>
</NotificationEvent>
</xsl:for-each>
<!--SettingScheduled-->
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>