У меня есть ниже входного XML и, как я работаю в XSL-преобразование с использованием Xalan API теперь ниже XML-положить нулевую отметку в XSL
<?xml version="1.0" encoding="UTF-8"?>
<Report xmlns:fpml="http://www.fpml.org/FpML-5/confirmation" xmlns="http://www.eurexchange.com/EurexIRSFullInventoryReport" name="CB202 Full Inventory Report">
<reportNameGrp>
<CM>
<acctTypGrp name="A1">
<ProductType name="OIS">
<currTypCod value="EUR">
<rateIndex name="EONIA">
<rateIndexTenor name="1D">
<idxSource>EONIA</idxSource>
<CCPTradeId id="612822">
<fpml:dataDocument fpmlVersion="5-0">
<fpml:trade>
<fpml:tradeHeader>
<fpml:partyTradeIdentifier>
<fpml:partyReference href="CPTY_612822"></fpml:partyReference>
<fpml:tradeId tradeIdScheme=""></fpml:tradeId>
</fpml:partyTradeIdentifier>
<fpml:partyTradeIdentifier>
<fpml:partyReference href="PO_612822"></fpml:partyReference>
<fpml:accountReference href="ACC_612822"></fpml:accountReference>
<fpml:tradeId tradeIdScheme="">9786042-2</fpml:tradeId>
<fpml:versionedTradeId>
<fpml:tradeId tradeIdScheme="">612822</fpml:tradeId>
<fpml:version>1</fpml:version>
</fpml:versionedTradeId>
</fpml:partyTradeIdentifier>
<fpml:tradeDate>2013-05-21</fpml:tradeDate>
<fpml:clearedDate>2013-11-13</fpml:clearedDate>
</fpml:tradeHeader>
<fpml:swap>
<fpml:swapStream id="fixedLeg_612822">
<fpml:payerPartyReference href="CPTY_612822"></fpml:payerPartyReference>
<fpml:receiverPartyReference href="PO_612822"></fpml:receiverPartyReference>
<fpml:calculationPeriodDates id="fixedLegCalcPeriodDates_612822">
<fpml:effectiveDate>
<fpml:unadjustedDate>2013-05-23</fpml:unadjustedDate>
<fpml:dateAdjustments>
<fpml:businessDayConvention>NONE</fpml:businessDayConvention>
</fpml:dateAdjustments>
</fpml:effectiveDate>
<fpml:terminationDate>
<fpml:unadjustedDate>2015-05-23</fpml:unadjustedDate>
<fpml:dateAdjustments>
<fpml:businessDayConvention>MODFOLLOWING</fpml:businessDayConvention>
<fpml:businessCenters>
<fpml:businessCenter>EUTA</fpml:businessCenter>
</fpml:businessCenters>
</fpml:dateAdjustments>
</fpml:terminationDate>
<fpml:calculationPeriodDatesAdjustments>
<fpml:businessDayConvention>MODFOLLOWING</fpml:businessDayConvention>
<fpml:businessCenters>
<fpml:businessCenter>EUTA</fpml:businessCenter>
</fpml:businessCenters>
</fpml:calculationPeriodDatesAdjustments>
<fpml:calculationPeriodFrequency>
<fpml:periodMultiplier>1</fpml:periodMultiplier>
<fpml:period>Y</fpml:period>
<fpml:rollConvention>23</fpml:rollConvention>
</fpml:calculationPeriodFrequency>
</fpml:calculationPeriodDates>
<fpml:paymentDates>
<fpml:calculationPeriodDatesReference href="fixedLegCalcPeriodDates_612822"></fpml:calculationPeriodDatesReference>
<fpml:paymentFrequency>
<fpml:periodMultiplier>1</fpml:periodMultiplier>
<fpml:period>Y</fpml:period>
</fpml:paymentFrequency>
<fpml:payRelativeTo>CalculationPeriodEndDate</fpml:payRelativeTo>
<fpml:paymentDaysOffset>
<fpml:periodMultiplier>1</fpml:periodMultiplier>
<fpml:period>D</fpml:period>
<fpml:dayType>Business</fpml:dayType>
</fpml:paymentDaysOffset>
<fpml:paymentDatesAdjustments>
<fpml:businessDayConvention>MODFOLLOWING</fpml:businessDayConvention>
<fpml:businessCenters>
<fpml:businessCenter>EUTA</fpml:businessCenter>
</fpml:businessCenters>
</fpml:paymentDatesAdjustments>
</fpml:paymentDates>
<fpml:calculationPeriodAmount>
<fpml:calculation>
<fpml:notionalSchedule>
<fpml:notionalStepSchedule>
<fpml:initialValue>100000000.00</fpml:initialValue>
<fpml:currency>EUR</fpml:currency>
</fpml:notionalStepSchedule>
</fpml:notionalSchedule>
<fpml:fixedRateSchedule>
<fpml:initialValue>0.01200000</fpml:initialValue>
</fpml:fixedRateSchedule>
<fpml:dayCountFraction>ACT/360</fpml:dayCountFraction>
</fpml:calculation>
</fpml:calculationPeriodAmount>
</fpml:swapStream>
<fpml:swapStream id="floatingLeg_612822">
<fpml:payerPartyReference href="PO_612822"></fpml:payerPartyReference>
<fpml:receiverPartyReference href="CPTY_612822"></fpml:receiverPartyReference>
<fpml:calculationPeriodDates id="floatingLegCalcPeriodDates_612822">
<fpml:effectiveDate>
<fpml:unadjustedDate>2013-05-23</fpml:unadjustedDate>
<fpml:dateAdjustments>
<fpml:businessDayConvention>NONE</fpml:businessDayConvention>
</fpml:dateAdjustments>
</fpml:effectiveDate>
<fpml:terminationDate>
<fpml:unadjustedDate>2015-05-23</fpml:unadjustedDate>
<fpml:dateAdjustments>
<fpml:businessDayConvention>MODFOLLOWING</fpml:businessDayConvention>
<fpml:businessCenters>
<fpml:businessCenter>EUTA</fpml:businessCenter>
</fpml:businessCenters>
</fpml:dateAdjustments>
</fpml:terminationDate>
<fpml:calculationPeriodDatesAdjustments>
<fpml:businessDayConvention>MODFOLLOWING</fpml:businessDayConvention>
<fpml:businessCenters>
<fpml:businessCenter>EUTA</fpml:businessCenter>
</fpml:businessCenters>
</fpml:calculationPeriodDatesAdjustments>
<fpml:calculationPeriodFrequency>
<fpml:periodMultiplier>1</fpml:periodMultiplier>
<fpml:period>Y</fpml:period>
<fpml:rollConvention>23</fpml:rollConvention>
</fpml:calculationPeriodFrequency>
</fpml:calculationPeriodDates>
<fpml:paymentDates>
<fpml:calculationPeriodDatesReference href="floatingLegCalcPeriodDates_612822"></fpml:calculationPeriodDatesReference>
<fpml:paymentFrequency>
<fpml:periodMultiplier>1</fpml:periodMultiplier>
<fpml:period>Y</fpml:period>
</fpml:paymentFrequency>
<fpml:payRelativeTo>CalculationPeriodEndDate</fpml:payRelativeTo>
<fpml:paymentDaysOffset>
<fpml:periodMultiplier>1</fpml:periodMultiplier>
<fpml:period>D</fpml:period>
<fpml:dayType>Business</fpml:dayType>
</fpml:paymentDaysOffset>
<fpml:paymentDatesAdjustments>
<fpml:businessDayConvention>MODFOLLOWING</fpml:businessDayConvention>
<fpml:businessCenters>
<fpml:businessCenter>EUTA</fpml:businessCenter>
</fpml:businessCenters>
</fpml:paymentDatesAdjustments>
</fpml:paymentDates>
<fpml:resetDates id="floatingLegresetDates_612822">
<fpml:calculationPeriodDatesReference href="floatingLegCalcPeriodDates_612822"></fpml:calculationPeriodDatesReference>
<fpml:resetRelativeTo>CalculationPeriodEndDate</fpml:resetRelativeTo>
<fpml:fixingDates>
<fpml:periodMultiplier>0</fpml:periodMultiplier>
<fpml:period>D</fpml:period>
<fpml:businessDayConvention>PRECEDING</fpml:businessDayConvention>
<fpml:businessCenters>
<fpml:businessCenter>EUTA</fpml:businessCenter>
</fpml:businessCenters>
<fpml:dateRelativeTo href="floatingLegresetDates_612822"></fpml:dateRelativeTo>
</fpml:fixingDates>
<fpml:resetFrequency>
<fpml:periodMultiplier>1</fpml:periodMultiplier>
<fpml:period>Y</fpml:period>
</fpml:resetFrequency>
<fpml:resetDatesAdjustments>
<fpml:businessDayConvention>MODFOLLOWING</fpml:businessDayConvention>
<fpml:businessCenters>
<fpml:businessCenter>EUTA</fpml:businessCenter>
</fpml:businessCenters>
</fpml:resetDatesAdjustments>
</fpml:resetDates>
<fpml:calculationPeriodAmount>
<fpml:calculation>
<fpml:notionalSchedule>
<fpml:notionalStepSchedule>
<fpml:initialValue>100000000.00</fpml:initialValue>
<fpml:currency>EUR</fpml:currency>
</fpml:notionalStepSchedule>
</fpml:notionalSchedule>
<fpml:floatingRateCalculation>
<fpml:floatingRateIndex>EUR-EONIA-OIS-COMPOUND</fpml:floatingRateIndex>
</fpml:floatingRateCalculation>
<fpml:dayCountFraction>ACT/360</fpml:dayCountFraction>
</fpml:calculation>
</fpml:calculationPeriodAmount>
</fpml:swapStream>
</fpml:swap>
<fpml:documentation>
<fpml:masterAgreement>
<fpml:masterAgreementType masterAgreementTypeScheme="">ISDA</fpml:masterAgreementType>
</fpml:masterAgreement>
<fpml:contractualDefinitions>ISDA2006</fpml:contractualDefinitions>
</fpml:documentation>
</fpml:trade>
<fpml:party id="CPTY_612822">
<fpml:partyId>EUREX</fpml:partyId>
<fpml:partyName>EUREX</fpml:partyName>
</fpml:party>
<fpml:party id="PO_612822">
<fpml:partyId>BOSLO</fpml:partyId>
<fpml:partyName>plc.</fpml:partyName>
</fpml:party>
<fpml:account id="ACC_612822">
<fpml:accountId>BOSLO_A1</fpml:accountId>
<fpml:accountBeneficiary href="PO_612822"></fpml:accountBeneficiary>
</fpml:account>
</fpml:dataDocument>
<novDateTime>2013-11-13 17:50:44.773</novDateTime>
</CCPTradeId>
</rateIndexTenor>
</rateIndex>
</currTypCod>
</ProductType>
</acctTypGrp>
</CM>
</reportNameGrp>
</Report>
, как вы можете видеть, что из приведенного выше XML я являюсь tring, чтобы прочитать значение параметра схемы tradeid, которое составляет 9786042-2, теперь я хочу поставить чек, который не является значением, в exexts в пареметре схемы торговли, а затем null, поэтому для этого я пришел с ниже xsl, но все же для cses, где значение параметра tradeid-схемы не существует, в этих случаях не обновляется null, пожалуйста, сообщите, как заполнить null для этих случаев.
<!-- Main template starts -->
<xsl:template match="/eur:Report">
<EurexMessage>
<EurexFlows>
<xsl:apply-templates select=".//eur:rateIndexTenor" />
<!-- select="eur:reportNameGrp/eur:CM/eur:acctTypGrp/eur:ProductType/eur:currTypCod/eur:rateIndex/eur:rateIndexTenor"
/> -->
</EurexFlows>
</EurexMessage>
</xsl:template>
<!-- sub template starts -->
<xsl:template match="eur:rateIndexTenor">
<xsl:for-each select="eur:CCPTradeId">
<EurexMessageObject>
<!-- ####***** contact id is nul not displayd ****##### ----->
<ContractID>
<xsl:choose>
<xsl:when test="fpml:dataDocument/*/*/fpml:partyTradeIdentifier/fpml:tradeId/@tradeIdScheme !=' '">
<xsl:value-of
select="fpml:dataDocument/*/*/fpml:partyTradeIdentifier[2]/fpml:tradeId" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'null'" />
</xsl:otherwise>
</xsl:choose>
</ContractID>
</EurexMessageObject>
</xsl:for-each>
</xsl:template>
В будущем, пожалуйста, предоставьте версию _simplified_ вашего требования. Копание всего этого XML и длинных XPaths является болезненным. – JLRishe
@JLRishe да согласен полностью, но, пожалуйста, сообщите нам о текущей проблеме заблаговременно. – sssddeewwqq
О, и если вы хотите, чтобы люди читали вашу прозу, они, скорее всего, это сделают, если вы будете использовать полные остановки и заглавные буквы. Это делает его похожим на вас. –