How do I output 2 nodes with their children?
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 output 2 nodes with their children?
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
xml document
My xslt code with template
Expected output
Code: Select all
<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>
Code: Select all
<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>
<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 code with template
Code: Select all
<?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>
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