0

入力XMLからフェッチされた値を使用して再帰要素を作成しようとしていますが、ループなどが欠落しているため、値がスペースとともに表示されますが、それぞれのタグの下には表示されません。

これが私が得ている入力XMLです:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
    <ns2:getOrgEntityListByOrgEntityIdsResponse xmlns:ns2="http://client.initiate.com/">
        <OrgEntity>
            <entityId>
                <enterpriseId>269</enterpriseId>
            </entityId>
            <ORG>
                <caudRecno>0</caudRecno>
                <maudRecno>0</maudRecno>
                <memSeqno>0</memSeqno>
                <memVerno>0</memVerno>
                <AccountTypeNameList>
                    <AccountTypeName>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>2</memSeqno>
                        <attrVal>HOSPITAL</attrVal>
                        <elemDecs/>
                    </AccountTypeName>
                </AccountTypeNameList>
                <FacilityTypeNameList>
                    <FacilityTypeName>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>3</memSeqno>
                        <attrVal>HOSPITAL</attrVal>
                        <elemDecs/>
                    </FacilityTypeName>
                </FacilityTypeNameList>
                <FaxNumberList>
                    <FaxNumber>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>12</memSeqno>
                        <custAddressGlobalUniqueIdentifier/>
                        <phoneAreaCode/>
                        <phoneNumber>7704544279</phoneNumber>
                        <sequenceNumber/>
                        <telephoneTypeName/>
                    </FaxNumber>
                </FaxNumberList>
                <InstitutionAddressList>
                    <InstitutionAddress>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>1</memSeqno>
                        <addressSequenceNumber/>
                        <addressTypeDescription/>
                        <custAddressGlobalUniqueIdentifier>12847292</custAddressGlobalUniqueIdentifier>
                        <permanentAddressIndicator/>
                        <sourceAddressLine1>4575 N SHALLOWFORD RD</sourceAddressLine1>
                        <sourceAddressLine2/>
                        <sourceAddressLine3/>
                        <sourceAddressLine4/>
                        <sourceCity>ATLANTA</sourceCity>
                        <sourceClientId/>
                        <sourceCode/>
                        <sourceCountryCode>USA</sourceCountryCode>
                        <sourceCounty/>
                        <sourceState>GA</sourceState>
                        <sourceZip>30338</sourceZip>
                        <sourceZipExtention/>
                        <standardAddressConcatenated>4575NSHALLOWFORDRD30338</standardAddressConcatenated>
                        <standardAddressLine1>4575 N SHALLOWFORD RD</standardAddressLine1>
                        <standardAddressLine2/>
                        <standardAddressLine2Copy/>
                        <standardAddressLine3/>
                        <standardAddressLine4/>
                        <standardCity>ATLANTA</standardCity>
                        <standardCountryCode>USA</standardCountryCode>
                        <standardCounty/>
                        <standardState>GA</standardState>
                        <standardZip>30338</standardZip>
                        <standardZipExtention/>
                    </InstitutionAddress>
                    <InstitutionAddress>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>1</memSeqno>
                        <addressSequenceNumber/>
                        <addressTypeDescription/>
                        <custAddressGlobalUniqueIdentifier>12847292</custAddressGlobalUniqueIdentifier>
                        <permanentAddressIndicator/>
                        <sourceAddressLine1>4575 N SHALLOWFORD RD</sourceAddressLine1>
                        <sourceAddressLine2/>
                        <sourceAddressLine3/>
                        <sourceAddressLine4/>
                        <sourceCity>ATLANTA</sourceCity>
                        <sourceClientId/>
                        <sourceCode/>
                        <sourceCountryCode>USA</sourceCountryCode>
                        <sourceCounty/>
                        <sourceState>GA</sourceState>
                        <sourceZip>30338</sourceZip>
                        <sourceZipExtention/>
                        <standardAddressConcatenated>4575NSHALLOWFORDRD30338rr</standardAddressConcatenated>
                        <standardAddressLine1>4575 N SHALLOWFORD RD</standardAddressLine1>
                        <standardAddressLine2/>
                        <standardAddressLine2Copy/>
                        <standardAddressLine3/>
                        <standardAddressLine4/>
                        <standardCity>ATLANTA</standardCity>
                        <standardCountryCode>USA</standardCountryCode>
                        <standardCounty/>
                        <standardState>GA</standardState>
                        <standardZip>30338</standardZip>
                        <standardZipExtention/>
                    </InstitutionAddress>
                </InstitutionAddressList>
                <InstitutionNameList>
                    <InstitutionName>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>9</memSeqno>
                        <institutionName>EMORY DUNWOODY MEDICAL</institutionName>
                    </InstitutionName>
                </InstitutionNameList>
                <LastChangeTimestampList>
                    <LastChangeTimestamp>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>7</memSeqno>
                        <dateVal>2009-06-19</dateVal>
                    </LastChangeTimestamp>
                </LastChangeTimestampList>
                <NationalProviderIdentifierNumberOrgList>
                    <NationalProviderIdentifierNumberOrg>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>10</memSeqno>
                        <idIssuer>NPI</idIssuer>
                        <idNumber>1679632137</idNumber>
                        <idSrcRecno>0</idSrcRecno>
                    </NationalProviderIdentifierNumberOrg>
                </NationalProviderIdentifierNumberOrgList>
                <OrgAddrKeyList>
                    <OrgAddrKey>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>1</memSeqno>
                        <custAddressGlobalUniqueIdentifier>12847292</custAddressGlobalUniqueIdentifier>
                        <standardAddressConcatenated>4575NSHALLOWFORDRD30338</standardAddressConcatenated>
                    </OrgAddrKey>
                    <OrgAddrKey>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>1</memSeqno>
                        <custAddressGlobalUniqueIdentifier>1284729299</custAddressGlobalUniqueIdentifier>
                        <standardAddressConcatenated>4575NSHALLOWFORDRD30338rr</standardAddressConcatenated>
                    </OrgAddrKey>
                </OrgAddrKeyList>
                <OrgLineageList>
                    <OrgLineage>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>1</memSeqno>
                        <sourceClientId>314612</sourceClientId>
                        <sourceCode>CIMS_HM</sourceCode>
                        <standardAddressConcatenated>4575NSHALLOWFORDRD30338</standardAddressConcatenated>
                    </OrgLineage>
                </OrgLineageList>
                <OrganizationDEANumberList>
                    <OrganizationDEANumber>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>9</memSeqno>
                        <idIssuer>DEA</idIssuer>
                        <idNumber>BE6185323</idNumber>
                        <idSrcRecno>0</idSrcRecno>
                    </OrganizationDEANumber>
                </OrganizationDEANumberList>
                <OrganizationHierarchyList>
                    <OrganizationHierarchy>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>1</memSeqno>
                        <careGroup>Care Group</careGroup>
                        <legalGroup>Legal Group</legalGroup>
                    </OrganizationHierarchy>
                </OrganizationHierarchyList>
                <OrganizationProspectFlagList>
                    <OrganizationProspectFlag>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>4</memSeqno>
                        <attrVal>N</attrVal>
                        <elemDecs/>
                    </OrganizationProspectFlag>
                </OrganizationProspectFlagList>
                <OrganizationSyntheticRecordFlagList>
                    <OrganizationSyntheticRecordFlag>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>5</memSeqno>
                        <attrVal>N</attrVal>
                        <elemDecs/>
                    </OrganizationSyntheticRecordFlag>
                </OrganizationSyntheticRecordFlagList>
                <OrganizationTargetDataList>
                    <OrganizationTargetData>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>1</memSeqno>
                        <targetDocileValue>Target Docile Value</targetDocileValue>
                        <targetLastChangeDate>2012-12-12T12:12:12-08:00</targetLastChangeDate>
                        <targetType>Target Type</targetType>
                    </OrganizationTargetData>
                </OrganizationTargetDataList>
                <SalesOrganizationDescriptionList>
                    <SalesOrganizationDescription>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>6</memSeqno>
                        <attrVal>IV</attrVal>
                        <elemDecs/>
                    </SalesOrganizationDescription>
                </SalesOrganizationDescriptionList>
                <TaxIdentificationNumberList>
                    <TaxIdentificationNumber>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>11</memSeqno>
                        <idIssuer>SSA</idIssuer>
                        <idNumber>581529062</idNumber>
                        <idSrcRecno>0</idSrcRecno>
                    </TaxIdentificationNumber>
                </TaxIdentificationNumberList>
                <TelephoneNumberList>
                    <TelephoneNumber>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>8</memSeqno>
                        <custAddressGlobalUniqueIdentifier>12847292</custAddressGlobalUniqueIdentifier>
                        <phoneAreaCode/>
                        <phoneNumber>770-454-2000</phoneNumber>
                        <sequenceNumber/>
                        <telephoneTypeName/>
                    </TelephoneNumber>
                </TelephoneNumberList>
                <TotalBedCountList>
                    <TotalBedCount>
                        <caudRecno>2</caudRecno>
                        <maudRecno>2</maudRecno>
                        <asaIdxno>0</asaIdxno>
                        <memSeqno>7</memSeqno>
                        <attrVal>118</attrVal>
                        <elemDecs/>
                    </TotalBedCount>
                </TotalBedCountList>
            </ORG>
            <ORGIdList>
                <ORGId>
                    <memIdnum>314612</memIdnum>
                    <srcCode>CIMS_HM</srcCode>
                </ORGId>
                <ORGId>
                    <memIdnum>PO7TWHX5</memIdnum>
                    <srcCode>HMS_IN</srcCode>
                </ORGId>
            </ORGIdList>
        </OrgEntity>
    </ns2:getOrgEntityListByOrgEntityIdsResponse>
</soap:Body>

これが私が書き込もうとしているXSLTです:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet exclude-result-prefixes="exslt saxon bpws cis p0 p1 ihmap" version="2.0"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:cis="http://www.approuter.com/schemas/2003/1/UserCallouts/"
xmlns:exslt="http://exslt.org/common" xmlns:ihmap="http://www.approuter.com/xmlns/2002/Mapping"
xmlns:p0="http://client.initiate.com/"
xmlns:p1="http://www.approuter.com/connectors/request/28/" xmlns:saxon="http://saxon.sf.net/"
xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="UTF-8" indent="yes" method="xml"/>
<xsl:template match="/">
    <xsl:element name="INSTITUTIONS">
        <xsl:for-each select="//OrgEntity">
            <xsl:element name="INSTITUTION">
                <xsl:element name="MDM_EID">
                    <xsl:value-of select="entityId/enterpriseId"/>
                </xsl:element>
                <xsl:element name="ADDRESSES">
                    <xsl:for-each select="ORG/InstitutionAddressList/InstitutionAddress">
                        <xsl:element name="ADDRESS">
                            <xsl:element name="ADDR_TYPE_NM">
                                <xsl:value-of select="standardCity"/>
                            </xsl:element>
                            <xsl:element name="ADDR_SEQ_NR">
                                <xsl:value-of select="standardCountryCode"/>
                            </xsl:element>
                            <xsl:element name="SRC_ADDRESS_LIST">
                                <xsl:element name="SRC_ADDRESS">
                                    <xsl:choose>
                                        <xsl:when
                                            test="//ORG/OrgAddrKeyList/OrgAddrKey[standardAddressConcatenated = //ORG/InstitutionAddressList/InstitutionAddress/standardAddressConcatenated]">
                                            <xsl:element name="SRC_ADDRESS_KEY">
                                              <xsl:value-of
                                              select="//ORG/OrgAddrKeyList/OrgAddrKey/custAddressGlobalUniqueIdentifier"
                                              />
                                            </xsl:element>
                                        </xsl:when>
                                    </xsl:choose>
                                </xsl:element>
                            </xsl:element>
                        </xsl:element>
                    </xsl:for-each>
                </xsl:element>
            </xsl:element>
        </xsl:for-each>
    </xsl:element>
</xsl:template>

期待される出力は次のようになります。

<?xml version="1.0" encoding="UTF-8"?>
<INSTITUTIONS>
<INSTITUTION>
    <MDM_EID>269</MDM_EID>
    <ADDRESSES>
        <ADDRESS>
            <ADDR_TYPE_NM>ATLANTA</ADDR_TYPE_NM>
            <ADDR_SEQ_NR>USA</ADDR_SEQ_NR>
            <SRC_ADDRESS_LIST>
                <SRC_ADDRESS>
                    <SRC_ADDRESS_KEY>12847292</SRC_ADDRESS_KEY>
                </SRC_ADDRESS>
                <SRC_ADDRESS>
                    <SRC_ADDRESS_KEY>1284729299</SRC_ADDRESS_KEY>
                </SRC_ADDRESS>
            </SRC_ADDRESS_LIST>
        </ADDRESS>
        <ADDRESS>
            <ADDR_TYPE_NM>ATLANTA</ADDR_TYPE_NM>
            <ADDR_SEQ_NR>USA</ADDR_SEQ_NR>
            <SRC_ADDRESS_LIST>
                <SRC_ADDRESS>
                    <SRC_ADDRESS_KEY>12847292</SRC_ADDRESS_KEY>
                </SRC_ADDRESS>
                <SRC_ADDRESS>
                    <SRC_ADDRESS_KEY>1284729299</SRC_ADDRESS_KEY>
                </SRC_ADDRESS>
            </SRC_ADDRESS_LIST>
        </ADDRESS>
    </ADDRESSES>
</INSTITUTION>

ただし、取得する出力は次のようになります。

<?xml version="1.0" encoding="UTF-8"?>
<INSTITUTIONS>
<INSTITUTION>
    <MDM_EID>269</MDM_EID>
    <ADDRESSES>
        <ADDRESS>
            <ADDR_TYPE_NM>ATLANTA</ADDR_TYPE_NM>
            <ADDR_SEQ_NR>USA</ADDR_SEQ_NR>
            <SRC_ADDRESS_LIST>
                <SRC_ADDRESS>
                    <SRC_ADDRESS_KEY>12847292 1284729299</SRC_ADDRESS_KEY>
                </SRC_ADDRESS>
            </SRC_ADDRESS_LIST>
        </ADDRESS>
        <ADDRESS>
            <ADDR_TYPE_NM>ATLANTA</ADDR_TYPE_NM>
            <ADDR_SEQ_NR>USA</ADDR_SEQ_NR>
            <SRC_ADDRESS_LIST>
                <SRC_ADDRESS>
                    <SRC_ADDRESS_KEY>12847292 1284729299</SRC_ADDRESS_KEY>
                </SRC_ADDRESS>
            </SRC_ADDRESS_LIST>
        </ADDRESS>
    </ADDRESSES>
</INSTITUTION>

これに関する助けをいただければ幸いです。

ありがとう!

4

1 に答える 1

1

連結されたアドレスから機関の一意のアドレスIDを検索しているようです。教育機関は実際には1つの住所にしか存在しないため、2つではなく1つの値を取得する必要があります。@Timはすでにコメントに記載されています。したがって、SRC_ADDRESS_LISTは次のように作成する必要があります:-

<xsl:element name="SRC_ADDRESS_LIST">
  <xsl:variable name="v" select="standardAddressConcatenated"/>
  <xsl:for-each select='//ORG/OrgAddrKeyList/OrgAddrKey[standardAddressConcatenated=$v]'>
    <xsl:element name="SRC_ADDRESS">
      <xsl:element name="SRC_ADDRESS_KEY">
        <xsl:value-of select="custAddressGlobalUniqueIdentifier"/>
      </xsl:element>
    </xsl:element>
  </xsl:for-each>
</xsl:element>
于 2012-11-02T08:34:27.947 に答える