How do I add conditions to xslt?
Posted: Mon Aug 05, 2019 7:25 pm
I have a xslt that I need help with.
How do I check CompDate has an @Op of E or A?
OR
TimeStampChange is the only element with @Op code
AND CaseEvent has no CompDate child element
i.e. \Integration\Case\CaseEvent\TimeStampChange@Op='E' and CompDate does not exist
Here is the xml that I am reading
Here is my xslt code
How do I check CompDate has an @Op of E or A?
OR
TimeStampChange is the only element with @Op code
AND CaseEvent has no CompDate child element
i.e. \Integration\Case\CaseEvent\TimeStampChange@Op='E' and CompDate does not exist
Here is the xml that I am reading
Code: Select all
<Integration>
<Case xmlns:user="http://tylertechnologies.com" InternalID="1625030311" ID="18482530">
<CaseEvent xmlns:reslib="urn:reslib" Op="E" Date="08/01/2019" ID="252950987" InternalEventID="1851141172">
<RevDate Op="E">08/01/2019</RevDate>
<CompDate Op="E">08/01/2019</CompDate>
<TimestampChange Op="E">08/01/2019 14:07:15:690</TimestampChange>
<EventType Word="NOPERWELL">Report</EventType>
</CaseEvent>
</Case>
<IntegrationConditions>
<IntegrationCondition Word="MMGUPD" Description="MMG Updates">
<NotificationEvent notificationType="MMGUpdate" elementState="Add" elementName="CaseEvent" >Testing</NotificationEvent>
</IntegrationCondition>
</IntegrationConditions>
</Integration>
Code: Select all
<?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="CaseEvent">
<xsl:if test="((@Op='E') and ((EventType/@Word='NOPERWELL') or (EventType/@Word='NORIGHTS')) and ((CompDate[@Op='E']) or (CompDate[@Op='A'])))">
<NotificationEvent notificationType="MMGUpdate">
<xsl:text>Testing</xsl:text>
</NotificationEvent>
</xsl:if>
</xsl:template>
</xsl:stylesheet>