How do I display PersonEthnicityCode for the Respondent

Here should go questions about transforming XML with XSLT and FOP.
winkimjr2
Posts: 62
Joined: Thu Jun 26, 2014 9:00 pm

How do I display PersonEthnicityCode for the Respondent

Post by winkimjr2 » Wed Dec 31, 2014 12:13 am

I have xml code with several CaseParties. I want to only display the ObservedEthnicity for the respondent. My xslt is displaying the ObservedEthnicity but for the first found CaseParty.
How do I change it to display the correct ObservedEthnicity for the respondent?
Here is my xml code

Code: Select all


<Integration xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:tsg="http://tsgweb.com" xmlns:IXML="http://tsgweb.com">
<Case InternalID="1616760296" ID="11683548" xmlns:user="http://tylertechnologies.com">
<CaseParty ID="16548426" InternalCasePartyID="1633585331" InternalPartyID="1614451562">
<ObservedRace Word="W">White</ObservedRace>
<ObservedEthnicity Word="NH">Non Hispanic</ObservedEthnicity>
<Connection Word="PET" BaseConnection="PL" ID="34645653" InternalCasePartyConnectionID="1635192840">
<Description>Petitioner</Description>
</Connection>
<CasePartyName Current="true" ID="9638953" InternalNameID="1615263003">
<FormattedName>Petitioner, Richard S</FormattedName>
</CasePartyName>
</CaseParty>
<CaseParty ID="16548378" InternalCasePartyID="1633585333" InternalPartyID="1614451515">
<ObservedRace Word="W">White</ObservedRace>
<ObservedEthnicity Word="R">Refused</ObservedEthnicity>
<Connection Word="CHL" BaseConnection="WA" ID="34645655" InternalCasePartyConnectionID="1635192842">
<Description>Child (Family/Juv)</Description>
</Connection>
<CasePartyName Current="true" ID="9638891" InternalNameID="1615262953">
<FormattedName>Dickens, Little</FormattedName>
</CasePartyName>
</CaseParty>
<CaseParty ID="16548427" InternalCasePartyID="1633585332" InternalPartyID="1614451563">
<ObservedRace Word="W">White</ObservedRace>
<ObservedEthnicity Word="H">Hispanic</ObservedEthnicity>
<Connection Word="RSP" BaseConnection="DF" ID="34645654" InternalCasePartyConnectionID="1635192841">
<Description>Respondent</Description>
</Connection>
<CasePartyName Current="true" ID="9638954" InternalNameID="1615263004">
<FormattedName>Respondent, Richard S</FormattedName>
</CasePartyName>
</CaseParty>
</Case>
</Integration>
My xslt code

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ext="http://www.courts.state.dc.us/ProtectionOrderExtension/1.0" xmlns:nc="http://niem.gov/niem/niem-core/2.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template name="ProtectionOrder">
<ext:ProtectionOrder>
<xsl:variable name="vProtectionOrderID">
<xsl:value-of select="@InternalProtectionOrderID"/>
</xsl:variable>
<!--Respondent Address-->
<xsl:for-each select="RespondentAddresses/Address">
<xsl:call-template name="Location"/>
</xsl:for-each>
<!--ext:ProtectionOrderID-->
<ext:ProtectionOrderID>
<xsl:value-of select="ProtectionOrderNumber"/>
</ext:ProtectionOrderID>
<!--Respondent-->
<xsl:for-each select="RespondentPartyID">
<xsl:for-each select="//CaseParty[(@InternalPartyID=current()/@InternalPartyID) and (Connection[(@Word='RSP') ])]">
<xsl:for-each select="//Party[@InternalPartyID=current()/@InternalPartyID]">
<xsl:call-template name="Respondent">
<xsl:with-param name="pProtectionOrderID">
<xsl:value-of select="$vProtectionOrderID"/>
</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</ext:ProtectionOrder>
</xsl:template>
<!--Respondent Template-->
<xsl:template name="Respondent">
<xsl:param name="pProtectionOrderID"/>
<ext:Respondent>
<nc:PersonEthnicityCode>
<xsl:choose>
<xsl:when test="//CaseParty[@ID=current()/@ID]/ObservedEthnicity/@Word='NH'">N</xsl:when>
<xsl:otherwise>
<xsl:if test="//CaseParty/ObservedEthnicity[@Word!='R']">
<xsl:value-of select="//CaseParty/ObservedEthnicity/@Word"/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</nc:PersonEthnicityCode>
</ext:Respondent>
<ext:RespondentPresentAtHearingIndicator>
<xsl:value-of select="/Integration/ProtectionOrder/MNProtectionOrderAdditional/IsRespondentPresent"/>
</ext:RespondentPresentAtHearingIndicator>
</xsl:template>
</xsl:stylesheet>

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: How do I display PersonEthnicityCode for the Respondent

Post by sorin_ristache » Wed Dec 31, 2014 10:47 am

Hello,

There are many XSLT experts available on this mailing list who can help you with that. Did you try posting the example code there?
Regards,
Sorin

<oXygen/> XML Editor Support

winkimjr2
Posts: 62
Joined: Thu Jun 26, 2014 9:00 pm

Re: How do I display PersonEthnicityCode for the Respondent

Post by winkimjr2 » Wed Dec 31, 2014 5:00 pm

sorin wrote:Hello,

There are many XSLT experts available on this mailing list who can help you with that. Did you try posting the example code there?
I did not know about that mailing list. I will post my question there. Thank you.

Post Reply