How do I display 2 element nodes structure?

Here should go questions about transforming XML with XSLT and FOP.
winkimjr2
Posts: 53

How do I display 2 element nodes structure?

Fri Oct 17, 2014 8:03 pm

I would like to use XSLT to display Conditions and Findings. I would like to check For each Finding or Condition node to determine if there is one or more related parties for the finding or condition being processed. If there are parties related to the finding or condition, a <Parties> structure will be represented as a child of <Findings> or as a child of <Condition>.

1. Im my xml under Findings, I have a finding with 2 related parties shown by the 2 Party internalPartyIDs. If there are NO parties related to the finding or condition, the <Parties> structure will NOT be shown. For each instance of <Party> for the Finding or Condition, I want to find <ProtectionOrderParty> node that has a value in its InternalPartyID attribute that matches the value in the InternalPartyID attribute of the <Party> element that is a child of Findings and Conditions.

Then I want to append the value from the FormattedName attribute of the ProtectionOrderPArtyName element where the Current attribute has a value of true to the end of the Findings and Conditions text.

An example of what I want for the <ext:FindingText> element look like with 2 related parties:

<ext:FindingText> The following parties need an order for protection and are referred to in this Order as "Protected Person(s)": Flintstone, Bam Bam; Noir, Flintstone, Wilma Ann</ext:FindingText>

2. Determine if there is one or more related addresses for the condition being processed. If there are addresses related to the condition, an <Addresses> structure will show as a child of <Condition>. For the xml I posted here, the result should look like this:

<ext:CondtionText> Respondent must not go to or enter the residence(s) of the Protected Person(s) located at the address(es) listed below. And Respondent must stay a reasonable distance away from the residence(s) of the Protected Person(s) specifically as follows (500 feet); And Respondent must stay a reasonable distance away from ANY FUTURE RESIDENCES of the Protected Person(s): 987 W Jump ALY W, Funny, MN, 55401; DAYCARE, 234 rock ALY, Funny, MN, 55432<ext:ConditionText>



My XSLT code for conditions

Code: Select all

<xsl:for-each select="MNProtectionOrderAdditional/Conditions/Condition">
  <ext:ProtectionOrderCondition>
    <ext:ConditionText>
      <xsl:value-of select="Description"/>
   </ext:ConditionText>
   <ext:ConditionCode>
     <xsl:value-of select="document(concat($gEnvPath,'\ConfigFiles\MNCISCodes\ProtectionOrderConditionCodeMapping.xml'))
   /ProtectionOrderConditionCodeMapping/Mapping[MNCISCode=current()/Condition/@Word]/BCACode"/>
  </ext:ConditionCode>
</ext:ProtectionOrderCondition>
</xsl:for-each>

My XSLT code for Findings

Code: Select all

<xsl:for-each select="MNProtectionOrderAdditional/Findings/Finding">
   <ext:ProtectionOrderFinding>
     <ext:FindingText>
   <xsl:value-of select="Description"/>
     </ext:FindingText>
   <ext:FindingCode>
   <xsl:value-of select="Finding/@Word"/>
    </ext:FindingCode>
</ext:ProtectionOrderFinding>
</xsl:for-each>




My xml code

Code: Select all

<Integration>
  <ProtectionOrder InternalProtectionOrderID="220" xmlns:user="http://tylertechnologies.com">
    <Deleted>false</Deleted>
    <RespondentPartyID InternalPartyID="1614450883">1614450883</RespondentPartyID>
    <RespondentNameID InternalNameID="1615262284">1615262284</RespondentNameID>
    <RespondentAddresses>
   <Address InternalAddressID="1618209023">
   <Confidential>false</Confidential>
   <AddressLine2>987 W Jump ALY W</AddressLine2>
   <AddressLine4>Funny, MN, 55401</AddressLine4>
   <Block>987</Block>
   <Street>Rubble</Street>
   <City>Funny</City>
   <State>MN</State>
   <Zip>55401</Zip>
   <Foreign>false</Foreign>
        </Address>
    </RespondentAddresses>
    <ProtectionOrderNumber>1400220</ProtectionOrderNumber>
   <ProtectionOrderParties>
          <ProtectionOrderParty InternalPartyID="1614450886">
   <ProtectionOrderPartyNames>
     <ProtectionOrderPartyName Current="true" InternalNameID="1615262287" FormattedName="Flintstone, Bam Bam"/>
     </ProtectionOrderPartyNames>
     <ProtectionOrderConnection>
     <Petitioner>false</Petitioner>
     <ProtectedParty>true</ProtectedParty>
     </ProtectionOrderConnection>
     </ProtectionOrderParty>
     <ProtectionOrderParty InternalPartyID="1614450882">
     <ProtectionOrderPartyNames>
     <ProtectionOrderPartyName Current="true" InternalNameID="1615262283" FormattedName="Flintstone, Wilma Ann"/>
   </ProtectionOrderPartyNames>
   <ProtectionOrderConnection>
   <Petitioner>true</Petitioner>
 </ProtectionOrderConnection>
 <MNProtectionOrderPartyAdditional xmlns:fn="http://www.w3.org/2005/xpath-functions">
   <ProtectedAddresses>
     <Address InternalAddressID="1618207867" Type="Standard">
     <Location Word="HOME">Home</Location>
     <Confidential>false</Confidential>
     <AddressLine2>987 W Jump ALY W</AddressLine2>
     <AddressLine4>Funny, MN, 55401</AddressLine4>
     <Block>987</Block>
     <PreDir Word="E">East</PreDir>
     <Street>Jump</Street>
     <AddrSfxKy Word="ALY">Alley</AddrSfxKy>
     <PostDir Word="W">West</PostDir>
     <City>Funny</City>
     <State>MN</State>
     <Zip>55401</Zip>
     <Foreign>false</Foreign>
     </Address>
     <Address InternalAddressID="1618209015" Type="Standard">
     <Location Word="DAYCARE">Daycare</Location>
     <Confidential>false</Confidential>
     <AddressLine2>234 rock ALY</AddressLine2>
     <AddressLine4>Funny, MN, 55432</AddressLine4>
     <Block>234</Block>
     <Street>rock</Street>
     <AddrSfxKy Word="ALY">Alley</AddrSfxKy>
     <City>Funny</City>
     <State>MN</State>
     <Zip>55432</Zip>
     <Foreign>false</Foreign>
     </Address>
  </ProtectedAddresses>
</MNProtectionOrderPartyAdditional>
  </ProtectionOrderParty>
</ProtectionOrderParties>
<MNProtectionOrderAdditional InternalID="220" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<IsForeignOrder>false</IsForeignOrder>
<Findings>
  <Finding>
    <Finding Word="EXP2">02 An Order For Protection is needed</Finding>
<Description>The following parties need an order for protection and are referred to in this Order as "Protected Person(s)":</Description>
<Parties>
  <Party InternalPartyID="1614450886"/>
  <Party InternalPartyID="1614450882"/>
</Parties>
</Finding>
</Findings>
<Conditions>   
   <Condition>
    <Condition Word="03C1EXPC">03.C.1 Respondent must not enter the residence</Condition>
               <Description>Respondent must not go to or enter the residence(s) of the Protected Person(s) located (see below); And Respondent must stay a reasonable distance away from the residence(s) of the Protected Person(s) specifically as follows (distance); And Respondent must stay a reasonable distance away from ANY FUTURE RESIDENCES of the Protected Person(s).</Description>
  <Address InternalAddressID="1618207867"/>
  </Condition>
</Conditions>
</MNProtectionOrderAdditional>
</ProtectionOrder>
</Integration>
winkimjr2
Posts: 53

Re: How do I display 2 element nodes structure?

Tue Oct 21, 2014 7:30 pm

[quote="winkimjr2"]Changing this one

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 2 guests