即使没有可用的代码,我也会收到PersonRaceCode

时间:2014-12-03 18:29:57

标签: xml xslt

我只希望{001}作为请愿者的受保护方,因为他们的<ext:PersonRaceCode>A</ext:PersonRaceCode>在xml中可用。 但是,即使其他受保护方在xml中没有<ObservedRace Word="A">Asian</ObservedRace>,我也会为双方获得相同的<ext:PersonRaceCode>A</ext:PersonRaceCode>

预期输出:

<ObservedRace>

当前输出错误

        <ext:ProtectedParty>
        <ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="true">1969-10-14</ext:PersonBirthDate>
        <nc:PersonName>
            <nc:PersonGivenName>Jeann</nc:PersonGivenName>
            <nc:PersonMiddleName>Kume</nc:PersonMiddleName>
            <nc:PersonSurName>Dudu</nc:PersonSurName>
            <nc:PersonNameSuffixText/>
            <nc:PersonFullName>Dudu, Jeann Kume</nc:PersonFullName>
        </nc:PersonName>
        <ext:PersonRaceCode>A</ext:PersonRaceCode>
        <nc:PersonSexCode>M</nc:PersonSexCode>
        <ext:PetitionerIndicator>true</ext:PetitionerIndicator>
    </ext:ProtectedParty>
    <ext:ProtectedParty>
        <ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="true">2001-03-15</ext:PersonBirthDate>
        <nc:PersonName>
            <nc:PersonGivenName>Brad</nc:PersonGivenName>
            <nc:PersonMiddleName/>
            <nc:PersonSurName>Mike</nc:PersonSurName>
            <nc:PersonNameSuffixText/>
            <nc:PersonFullName>Mike, Brad</nc:PersonFullName>
        </nc:PersonName>
        <ext:PersonRaceCode/>
        <nc:PersonSexCode>M</nc:PersonSexCode>
        <ext:PetitionerIndicator>false</ext:PetitionerIndicator>
    </ext:ProtectedParty>

我的xml代码

        <ext:ProtectedParty>
        <ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="true">1969-10-14</ext:PersonBirthDate>
        <nc:PersonName>
            <nc:PersonGivenName>Jeann</nc:PersonGivenName>
            <nc:PersonMiddleName>Kume</nc:PersonMiddleName>
            <nc:PersonSurName>Dudu</nc:PersonSurName>
            <nc:PersonNameSuffixText/>
            <nc:PersonFullName>Dudu, Jeann Kume</nc:PersonFullName>
        </nc:PersonName>
        <ext:PersonRaceCode>A</ext:PersonRaceCode>
        <nc:PersonSexCode>M</nc:PersonSexCode>
        <ext:PetitionerIndicator>true</ext:PetitionerIndicator>
    </ext:ProtectedParty>
    <ext:ProtectedParty>
        <ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="true">2001-03-15</ext:PersonBirthDate>
        <nc:PersonName>
            <nc:PersonGivenName>Brad</nc:PersonGivenName>
            <nc:PersonMiddleName/>
            <nc:PersonSurName>Mike</nc:PersonSurName>
            <nc:PersonNameSuffixText/>
            <nc:PersonFullName>Mike, Brad</nc:PersonFullName>
        </nc:PersonName>
        <ext:PersonRaceCode>A</ext:PersonRaceCode>
        <nc:PersonSexCode>M</nc:PersonSexCode>
        <ext:PetitionerIndicator>false</ext:PetitionerIndicator>
    </ext:ProtectedParty>

我的xslt代码有两个受保护方请愿者模板。请愿人也可以是受保护的一方,这意味着并非所有请愿人都是受保护方,而且并非所有受保护方都是请愿人。

xslt代码

<Integration xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:tsg="http://tsgweb.com" xmlns:IXML="http://tsgweb.com">
    <Case InternalID="1616758956" ID="11682320" xmlns:user="http://tylertechnologies.com">
        <CaseParty ID="14374736" InternalCasePartyID="1633583492" InternalPartyID="1612267260">
            <SendNotice>true</SendNotice>
            <ObservedRace Word="A">Asian</ObservedRace>
            <Connection Word="PET" BaseConnection="PL" ID="34643485" InternalCasePartyConnectionID="1635190996">
                <Description>Petitioner</Description>
            </Connection>
            <CasePartyName Current="true" ID="4990971" InternalNameID="1612653737">
                <NameType>Standard</NameType>
                <NameFirst>Jeann</NameFirst>
                <NameMiddle>Kume</NameMiddle>
                <NameLast>Dudu</NameLast>
                <FormattedName>Dudu, Jeann Kume</FormattedName>
            </CasePartyName>
        </CaseParty>
        <CaseParty ID="16548387" InternalCasePartyID="1633583509" InternalPartyID="1614451524">
            <SendNotice>true</SendNotice>
            <Connection Word="MNR" BaseConnection="O2" ID="34643502" InternalCasePartyConnectionID="1635191013">
                <Description>Minor</Description>
            </Connection>
            <CasePartyName Current="true" ID="9638900" InternalNameID="1615262962">
                <NameType>Standard</NameType>
                <NameFirst>Brad</NameFirst>
                <NameLast>Mike</NameLast>
                <FormattedName>Mike, Brad</FormattedName>
            </CasePartyName>
        </CaseParty>
        <ProtectionOrders>
            <ProtectionOrder Op="E" InternalProtectionOrderID="1349">
                <Deleted>false</Deleted>
                <RespondentPartyID InternalPartyID="1610253026">1610253026</RespondentPartyID>
                <RespondentNameID InternalNameID="1610281862">1610281862</RespondentNameID>
                <ProtectionOrderNumber>1400350</ProtectionOrderNumber>
                <ProtectionOrderParties>
                    <ProtectionOrderParty InternalPartyID="1612267260">
                        <ProtectionOrderPartyNames>
                            <ProtectionOrderPartyName Current="true" InternalNameID="1612653737" FormattedName="Dudu, Jeann Kume"/>
                        </ProtectionOrderPartyNames>
                        <ProtectionOrderConnection>
                            <Petitioner>true</Petitioner>
                            <ProtectedParty>true</ProtectedParty>
                            <Minor>false</Minor>
                        </ProtectionOrderConnection>
                    </ProtectionOrderParty>
                    <ProtectionOrderParty InternalPartyID="1614451524">
                        <ProtectionOrderPartyNames>
                            <ProtectionOrderPartyName Current="true" InternalNameID="1615262962" FormattedName="Mike, Brad"/>
                        </ProtectionOrderPartyNames>
                        <ProtectionOrderConnection>
                            <Petitioner>false</Petitioner>
                            <ProtectedParty>true</ProtectedParty>
                            <Minor>true</Minor>
                        </ProtectionOrderConnection>
                    </ProtectionOrderParty>
                </ProtectionOrderParties>
            </ProtectionOrder>
        </ProtectionOrders>
    </Case>
    <Party ID="14374736" InternalPartyID="1612267260">
        <Gender Word="M ">Male</Gender>
        <Race Word="W">White</Race>
        <DateOfBirth Current="true">10/14/1969</DateOfBirth>
        <PartyName ID="4990971" Current="true" InternalNameID="1612653737">
            <NameType>Standard</NameType>
            <NameFirst>Jeann</NameFirst>
            <NameMiddle>Kume</NameMiddle>
            <NameLast>Dudu</NameLast>
            <FormattedName>Dudu, Jeann Kume</FormattedName>
        </PartyName>
    </Party>
    <Party ID="16548387" InternalPartyID="1614451524">
        <Gender Word="M ">Male</Gender>
        <DateOfBirth Current="true">03/15/2001</DateOfBirth>
        <PartyName ID="9638900" Current="true" InternalNameID="1615262962">
            <NameType>Standard</NameType>
            <NameFirst>Brad</NameFirst>
            <NameLast>Mike</NameLast>
            <FormattedName>Mike, Brad</FormattedName>
        </PartyName>
    </Party>
    <IntegrationConditions>
        <IntegrationCondition>
            <NotificationEvent internalProtectionOrderID="1349" protectionOrderNumber="1400350" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">Signed</NotificationEvent>
        </IntegrationCondition>
    </IntegrationConditions>
</Integration>

2 个答案:

答案 0 :(得分:0)

为了寻找ObservedRace Word ='A',那么你的条件应该是

<xsl:value-of select="/Integration/Case/CaseParty/ObservedRace/@Word[. = 'A']"/>

它将打印属性'Word'值,即A。

答案 1 :(得分:0)

这就是我所做的,它正在发挥作用。包括current确保它将为每个CaseParty获取PersonRaceCode。如果没有最新情况,它只需要第一个caseparty并将其添加到任何其他可用的caseparty。

<ext:PersonRaceCode> 
<xsl:value-of select="//Case/CaseParty[@InternalPartyID=current()/@InternalPartyID]/ObservedRa‌​ce/@Word"/> 
</ext:PersonRaceCode>