How do I add conditions to xslt?
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 62
- Joined: Thu Jun 26, 2014 9:00 pm
How do I add conditions to xslt?
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>
-
- Posts: 84
- Joined: Wed Jul 19, 2017 6:04 pm
- Location: Austria
- Contact:
Re: How do I add conditions to xslt?
Hi!
But here
BTW, little syntax improvement: Instead of you may use
best Oleksii
If you want to test if child nodes of CaseEvent not exist you might use this test:i.e. \Integration\Case\CaseEvent\TimeStampChange@Op='E' and CompDate does not exist
Code: Select all
not(TimestampChange[@Op='E'] and CompDate)
you are asking fo something else. Also your XSLT test ist something else.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
BTW, little syntax improvement: Instead of
Code: Select all
((CompDate[@Op='E']) or (CompDate[@Op='A']))
Code: Select all
CompDate[@Op=('E', 'A')]
Kind regards,
Oleksii Sapov-Erlinger
Oleksii Sapov-Erlinger
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service