none
How do I add a condition for notificationevents? RRS feed

  • Question

  • I need help to add a condition to my xslt. What I need is a condition for all NotificationEvents to have a HearingType/@Word='ACT' How do I do it?

    <?xml version="1.0" encoding="UTF-8"?>
    <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') and (HearingType/@Word='ACT')">
    				<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='D' and count(Setting/CourtroomMinutes/HearingResult/@Word)=0">
    				<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>HearingDeleted</xsl:text>
    				</NotificationEvent>
    			</xsl:when>
    			<!--HearingDeleted-->
    			<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:for-each select="Setting[@Op='E']">
    					<xsl:if test="string-length(RescheduledType)!=0">
    						<NotificationEvent notificationType="PrepareHearingDocument">
    							<xsl:attribute name="elementState">Existing</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>SettingRescheduled</xsl:text>
    						</NotificationEvent>
    					</xsl:if>
    					<!--SettingRescheduled-->
    					<xsl:choose>
    						<xsl:when test="(string-length(CancelledReason)!=0) and (CancelledReason/@Op='E')">
    							<NotificationEvent notificationType="PrepareHearingDocument">
    								<xsl:attribute name="elementState">Existing</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>SettingCancelled</xsl:text>
    							</NotificationEvent>
    						</xsl:when>
    						<!--SettingCancelled-->
    						<xsl:when test="(Cancelled='True') and (string-length(RescheduledReason)=0)">
    							<NotificationEvent notificationType="PrepareHearingDocument">
    								<xsl:attribute name="elementState">Existing</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>SettingCancelled</xsl:text>
    							</NotificationEvent>
    						</xsl:when>
    						<!--SettingCancelled-->
    						<xsl:when test="(StartTime/@Op='E') or (EndTime/@Op='E') or (InterpreterNeeded/@Op='E') or (Interpreter/@Op='E') or (CourtSessionBlock/StartTime/@Op='E') or (CourtSessionBlock/EndTime/@Op='E')">
    							<NotificationEvent notificationType="PrepareHearingDocument">
    								<xsl:attribute name="elementState">Existing</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>SettingModified</xsl:text>
    							</NotificationEvent>
    						</xsl:when>
    						<!--SettingModified-->
    					</xsl:choose>
    				</xsl:for-each>
    				<xsl:for-each select="Setting/CourtroomMinutes">
    					<xsl:if test="(@Op='E') and (count(*[name(.)!='HearingResult'][@Op='E'])!=0) and (string-length(HearingResult/@Op)=0)">
    						<NotificationEvent notificationType="PrepareHearingDocument">
    							<xsl:attribute name="elementState">Existing</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>SettingHeldModified</xsl:text>
    						</NotificationEvent>
    					</xsl:if>
    					<!--SettingHeldModified-->
    					<!--Setting Held-->
    					<xsl:if test="((@Op='A') or (@Op='E')) and (HearingResult/@Op='E') and ((HearingResult='Held') or (HearingResult/@Word='CNVOCCUR'))">
    						<NotificationEvent notificationType="PrepareHearingDocument">
    							<xsl:attribute name="elementState">Existing</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>
    							<!--Setting Held-->
    							<xsl:text>SettingHeld</xsl:text>
    						</NotificationEvent>
    					</xsl:if>
    					<!--SettingHeld-->
    					<xsl:if test="(@Op='D')">
    						<NotificationEvent notificationType="PrepareHearingDocument">
    							<xsl:attribute name="elementState">Existing</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>SettingHeldReversed</xsl:text>
    						</NotificationEvent>
    					</xsl:if>
    					<!--SettingHeldReversed-->
    				</xsl:for-each>
    			</xsl:otherwise>
    		</xsl:choose>
    	</xsl:template>
    </xsl:stylesheet>





    Thursday, February 7, 2019 4:50 PM

All replies

  • Hi winkimjr2,

    Thank you for posting here.

    >>What I need is a condition for all NotificationEvents to have a HearingType/@Word='ACT' How do I do it?

    I do not understand your question. Do you mean you want to add a Condition node after NotificationEvent which has a test value of HearingType/@Word='ACT' ? Like the xml below?

    <xsl:if test="(HearingType/@Word='ACT')">
    					<NotificationEvent notificationType="PrepareHearingDocument">
    <Condition>
    						<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>
    </Condition>
    					</NotificationEvent>
    				</xsl:if>

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, February 11, 2019 3:25 AM
    Moderator