Solved

XSL Style Sheet Question

Posted on 2009-07-07
7
899 Views
Last Modified: 2013-11-18
Hello,

I am trying to extract data from the XML via an XSL seems I am not able to extract the data though looked at the syntax documentation but not able to find anything wrong with my XSL which is also given below the sample XML.

Your help would be appreciated.

Thanks,
Alok

Sample XML

<?xml version="1.0" encoding="UTF-8"?>
<SWBML xmlns="http://www.fpml.org/2005/FpML-4-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="4-2" xsi:schemaLocation="http://www.fpml.org/2005/FpML-4-2 swbml-ird-main-4-2.xsd">
      <swbHeader>
            <swbBrokerTradeId>ALOK4_1108299</swbBrokerTradeId>
            <swbBrokerTradeVersionId>15</swbBrokerTradeVersionId>
            <swbTradeSource>Voice</swbTradeSource>
            <swbRecipient id="_recip_1_">
                  <partyReference href="partyA"/>
            </swbRecipient>
            <swbRecipient id="_recip_2_">
                  <partyReference href="partyB"/>
            </swbRecipient>
      </swbHeader>
      <swbStructuredTradeDetails>
            <swbProductType>Single Currency Basis Swap</swbProductType>
            <FpML xmlns="http://www.fpml.org/2005/FpML-4-2" version="4-2" xsi:type="DataDocument">
                  <trade id="ALOK4_1108299">
                        <tradeHeader>
                              <partyTradeIdentifier>
                                    <partyReference href="partyA"/>
                                    <tradeId tradeIdScheme="http://www.swapswire.com/spec/2001/trade-id-1-0">ALOK4_1108299</tradeId>
                              </partyTradeIdentifier>
                              <partyTradeIdentifier>
                                    <partyReference href="partyB"/>
                                    <tradeId tradeIdScheme="http://www.swapswire.com/spec/2001/trade-id-1-0">ALOK4_1108299</tradeId>
                              </partyTradeIdentifier>
                              <tradeDate>2009-07-07</tradeDate>
                        </tradeHeader>
                        <swap>
                              <swapStream id="floatingLeg">
                                    <payerPartyReference href="partyA"/>
                                    <receiverPartyReference href="partyB"/>
                                    <calculationPeriodDates id="floatingLegCalcPeriodDates">
                                          <effectiveDate>
                                                <unadjustedDate>2009-07-09</unadjustedDate>
                                                <dateAdjustments>
                                                      <businessDayConvention>NONE</businessDayConvention>
                                                </dateAdjustments>
                                          </effectiveDate>
                                          <terminationDate>
                                                <unadjustedDate>2010-07-09</unadjustedDate>
                                                <dateAdjustments>
                                                      <businessDayConvention>MODFOLLOWING</businessDayConvention>
                                                      <businessCenters>
                                                            <businessCenter>GBLO</businessCenter>
                                                            <businessCenter>USNY</businessCenter>
                                                      </businessCenters>
                                                </dateAdjustments>
                                          </terminationDate>
                                          <calculationPeriodDatesAdjustments>
                                                <businessDayConvention>MODFOLLOWING</businessDayConvention>
                                                <businessCenters>
                                                      <businessCenter>GBLO</businessCenter>
                                                      <businessCenter>USNY</businessCenter>
                                                </businessCenters>
                                          </calculationPeriodDatesAdjustments>
                                          <calculationPeriodFrequency>
                                                <periodMultiplier>1</periodMultiplier>
                                                <period>M</period>
                                                <rollConvention>9</rollConvention>
                                          </calculationPeriodFrequency>
                                    </calculationPeriodDates>
                                    <paymentDates>
                                          <calculationPeriodDatesReference href="floatingLegCalcPeriodDates"/>
                                          <paymentFrequency>
                                                <periodMultiplier>1</periodMultiplier>
                                                <period>M</period>
                                          </paymentFrequency>
                                          <payRelativeTo>CalculationPeriodEndDate</payRelativeTo>
                                          <paymentDatesAdjustments>
                                                <businessDayConvention>MODFOLLOWING</businessDayConvention>
                                                <businessCenters>
                                                      <businessCenter>GBLO</businessCenter>
                                                      <businessCenter>USNY</businessCenter>
                                                </businessCenters>
                                          </paymentDatesAdjustments>
                                    </paymentDates>
                                    <resetDates id="floatingLegResetDates">
                                          <calculationPeriodDatesReference href="floatingLegCalcPeriodDates"/>
                                          <resetRelativeTo>CalculationPeriodStartDate</resetRelativeTo>
                                          <fixingDates>
                                                <periodMultiplier>-2</periodMultiplier>
                                                <period>D</period>
                                                <dayType>Business</dayType>
                                                <businessDayConvention>NONE</businessDayConvention>
                                                <businessCenters>
                                                      <businessCenter>GBLO</businessCenter>
                                                </businessCenters>
                                                <dateRelativeTo href="floatingLegResetDates"/>
                                          </fixingDates>
                                          <resetFrequency>
                                                <periodMultiplier>1</periodMultiplier>
                                                <period>M</period>
                                          </resetFrequency>
                                          <resetDatesAdjustments>
                                                <businessDayConvention>MODFOLLOWING</businessDayConvention>
                                                <businessCenters>
                                                      <businessCenter>GBLO</businessCenter>
                                                      <businessCenter>USNY</businessCenter>
                                                </businessCenters>
                                          </resetDatesAdjustments>
                                    </resetDates>
                                    <calculationPeriodAmount>
                                          <calculation>
                                                <notionalSchedule>
                                                      <notionalStepSchedule>
                                                            <initialValue>50000000</initialValue>
                                                            <currency>USD</currency>
                                                      </notionalStepSchedule>
                                                </notionalSchedule>
                                                <floatingRateCalculation>
                                                      <floatingRateIndex>USD-LIBOR-BBA</floatingRateIndex>
                                                      <indexTenor>
                                                            <periodMultiplier>1</periodMultiplier>
                                                            <period>M</period>
                                                      </indexTenor>
                                                      <spreadSchedule>
                                                            <initialValue>0.0007</initialValue>
                                                      </spreadSchedule>
                                                      <initialRate>0.06</initialRate>
                                                </floatingRateCalculation>
                                                <dayCountFraction>ACT/360</dayCountFraction>
                                          </calculation>
                                    </calculationPeriodAmount>
                              </swapStream>
                              <swapStream id="floatingLeg2">
                                    <payerPartyReference href="partyB"/>
                                    <receiverPartyReference href="partyA"/>
                                    <calculationPeriodDates id="floatingLeg2CalcPeriodDates">
                                          <effectiveDate>
                                                <unadjustedDate>2009-07-09</unadjustedDate>
                                                <dateAdjustments>
                                                      <businessDayConvention>NONE</businessDayConvention>
                                                </dateAdjustments>
                                          </effectiveDate>
                                          <terminationDate>
                                                <unadjustedDate>2010-07-09</unadjustedDate>
                                                <dateAdjustments>
                                                      <businessDayConvention>MODFOLLOWING</businessDayConvention>
                                                      <businessCenters>
                                                            <businessCenter>GBLO</businessCenter>
                                                            <businessCenter>USNY</businessCenter>
                                                      </businessCenters>
                                                </dateAdjustments>
                                          </terminationDate>
                                          <calculationPeriodDatesAdjustments>
                                                <businessDayConvention>MODFOLLOWING</businessDayConvention>
                                                <businessCenters>
                                                      <businessCenter>GBLO</businessCenter>
                                                      <businessCenter>USNY</businessCenter>
                                                </businessCenters>
                                          </calculationPeriodDatesAdjustments>
                                          <calculationPeriodFrequency>
                                                <periodMultiplier>3</periodMultiplier>
                                                <period>M</period>
                                                <rollConvention>9</rollConvention>
                                          </calculationPeriodFrequency>
                                    </calculationPeriodDates>
                                    <paymentDates>
                                          <calculationPeriodDatesReference href="floatingLeg2CalcPeriodDates"/>
                                          <paymentFrequency>
                                                <periodMultiplier>3</periodMultiplier>
                                                <period>M</period>
                                          </paymentFrequency>
                                          <payRelativeTo>CalculationPeriodEndDate</payRelativeTo>
                                          <paymentDatesAdjustments>
                                                <businessDayConvention>MODFOLLOWING</businessDayConvention>
                                                <businessCenters>
                                                      <businessCenter>GBLO</businessCenter>
                                                      <businessCenter>USNY</businessCenter>
                                                </businessCenters>
                                          </paymentDatesAdjustments>
                                    </paymentDates>
                                    <resetDates id="floatingLeg2ResetDates">
                                          <calculationPeriodDatesReference href="floatingLeg2CalcPeriodDates"/>
                                          <resetRelativeTo>CalculationPeriodStartDate</resetRelativeTo>
                                          <fixingDates>
                                                <periodMultiplier>-2</periodMultiplier>
                                                <period>D</period>
                                                <dayType>Business</dayType>
                                                <businessDayConvention>NONE</businessDayConvention>
                                                <businessCenters>
                                                      <businessCenter>GBLO</businessCenter>
                                                </businessCenters>
                                                <dateRelativeTo href="floatingLeg2ResetDates"/>
                                          </fixingDates>
                                          <resetFrequency>
                                                <periodMultiplier>3</periodMultiplier>
                                                <period>M</period>
                                          </resetFrequency>
                                          <resetDatesAdjustments>
                                                <businessDayConvention>MODFOLLOWING</businessDayConvention>
                                                <businessCenters>
                                                      <businessCenter>GBLO</businessCenter>
                                                      <businessCenter>USNY</businessCenter>
                                                </businessCenters>
                                          </resetDatesAdjustments>
                                    </resetDates>
                                    <calculationPeriodAmount>
                                          <calculation>
                                                <notionalSchedule>
                                                      <notionalStepSchedule>
                                                            <initialValue>50000000</initialValue>
                                                            <currency>USD</currency>
                                                      </notionalStepSchedule>
                                                </notionalSchedule>
                                                <floatingRateCalculation>
                                                      <floatingRateIndex>USD-LIBOR-BBA</floatingRateIndex>
                                                      <indexTenor>
                                                            <periodMultiplier>3</periodMultiplier>
                                                            <period>M</period>
                                                      </indexTenor>
                                                      <initialRate>0.06</initialRate>
                                                </floatingRateCalculation>
                                                <dayCountFraction>ACT/360</dayCountFraction>
                                          </calculation>
                                    </calculationPeriodAmount>
                              </swapStream>
                        </swap>
                        <otherPartyPayment>
                              <payerPartyReference href="partyA"/>
                              <receiverPartyReference href="broker1"/>
                              <paymentAmount>
                                    <currency>USD</currency>
                                    <amount>0.0</amount>
                              </paymentAmount>
                        </otherPartyPayment>
                        <otherPartyPayment>
                              <payerPartyReference href="partyB"/>
                              <receiverPartyReference href="broker1"/>
                              <paymentAmount>
                                    <currency>USD</currency>
                                    <amount>0.0</amount>
                              </paymentAmount>
                        </otherPartyPayment>
                        <documentation>
                              <masterAgreement>
                                    <masterAgreementType masterAgreementTypeScheme="http://www.swapswire.com/spec/2001/master-agreement-type-1-0">ISDA</masterAgreementType>
                              </masterAgreement>
                              <contractualDefinitions>ISDA2006</contractualDefinitions>
                        </documentation>
                  </trade>
                  <party id="partyA">
                        <partyId>BB1TULLLE1</partyId>
                  </party>
                  <party id="partyB">
                        <partyId>BB2TULLLE1</partyId>
                  </party>
                  <party id="broker1">
                        <partyId>TULL_NY</partyId>
                  </party>
            </FpML>
            <swbExtendedTradeDetails>
                  <swbProductTerm>
                        <periodMultiplier>1</periodMultiplier>
                        <period>Y</period>
                  </swbProductTerm>
                  <swbMessageText>Brokerage to be invoiced directly with Tullett.</swbMessageText>
            </swbExtendedTradeDetails>
      </swbStructuredTradeDetails>
</SWBML>

Sample XSL

<!--<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">-->
            <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fpml="http://www.fpml.org/2005/FpML-4-2"
xmlns:fo="http://www.w3.org/1999/XSL/Format" >
    <xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/>

    <xsl:template match="/">
        <xsl:text disable-output-escaping="yes">TradeVersion: </xsl:text>
        <xsl:value-of select="SWBML/swbHeader/swbBrokerTradeVersionId"/>
        <xsl:text>&#xD;</xsl:text>
          <!--<xsl:text disable-output-escaping="yes">swbRecipient Called. </xsl:text>-->
        <xsl:apply-templates select="/SWBML/swbHeader/swbRecipient"/>
          <!--<xsl:text disable-output-escaping="yes">Party Called. </xsl:text>-->
          <xsl:apply-templates select="/SWBML/swbStructuredTradeDetails/FpML/party"/>
    </xsl:template>

    <xsl:template match="swbRecipient">
        <xsl:param name="href" select="./partyReference/@href"/>
        <xsl:param name="dealType" select="/SWBML/swbStructuredTradeDetails/swbProductType"/>
        <xsl:param name="definingleg" select="'fixedLeg'"/>
        <xsl:param name="definingpath" select="/SWBML/swbStructuredTradeDetails/FpML/trade/swap/swapStream"/>
          <!--<xsl:text disable-output-escaping="yes">swbRecipient In. </xsl:text>-->
        <xsl:choose>
              <xsl:when test="$dealType = 'Single Currency Basis Swap'">
                  <xsl:call-template name="getRecipientInformation">
                      <xsl:with-param name="href" select="$href"/>
                      <xsl:with-param name="payer" select="/SWBML/swbStructuredTradeDetails/FpML/trade/swap/swapStreams/swapStream[@id='floatingLeg']/payerPartyReference"/>
                      <xsl:with-param name="receiver" select="/SWBML/swbStructuredTradeDetails/FpML/trade/swap/swapStreams/swapStream[@id='floatingLeg']/receiverPartyReference"/>
                  </xsl:call-template>
              </xsl:when>

            <xsl:otherwise>
                <xsl:call-template name="getRecipientInformation">
                    <xsl:with-param name="href" select="$href"/>
                    <xsl:with-param name="payer" select="/SWBML/swbStructuredTradeDetails/FpML/trade/swap/swapStream[@id=$definingleg]/payerPartyReference"/>
                    <xsl:with-param name="receiver" select="/SWBML/swbStructuredTradeDetails/FpML/trade/swap/swapStream[@id=$definingleg]/receiverPartyReference"/>
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="getRecipientInformation">
        <xsl:param name="href"/>
        <xsl:param name="payer"/>
        <xsl:param name="receiver"/>
        <xsl:choose>
            <xsl:when test="$payer/@href = $href">
                <xsl:text disable-output-escaping="yes">PayerRecipTag: </xsl:text>
                <xsl:value-of select="@id"/>
            </xsl:when>
            <xsl:when test="$receiver/@href = $href">
                <xsl:text disable-output-escaping="yes">ReceiverRecipTag: </xsl:text>
                <xsl:value-of select="@id"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:text disable-output-escaping="yes"></xsl:text>
                <xsl:value-of select="@id"/>
            </xsl:otherwise>
        </xsl:choose>
        <xsl:text>&#xD;</xsl:text>
    </xsl:template>

    <xsl:template match="party">
        <xsl:param name="href" select="./@id"/>
        <xsl:param name="dealType" select="/SWBML/swbStructuredTradeDetails/swbProductType"/>
        <xsl:param name="definingleg" select="'floatingLeg'"/>
        <xsl:param name="definingpath" select="/SWBML/swbStructuredTradeDetails/FpML/trade/swap/swapStream"/>
        <xsl:choose>
            <!--<xsl:when test="$dealType = 'Single Currency Basis Swap'">-->
                <!--<xsl:call-template name="getFraSwiftInformation">-->
                    <!--<xsl:with-param name="href" select="$href"/>-->
                <!--</xsl:call-template>-->
            <!--</xsl:when>-->

            <xsl:when test="$dealType = 'CDS'">
                <xsl:call-template name="getCDSSwiftInformation">
                    <xsl:with-param name="href" select="$href"/>
                </xsl:call-template>
            </xsl:when>

            <xsl:otherwise>
                <xsl:choose>
                    <xsl:when test="$definingpath[@id=$definingleg]/payerPartyReference/@href = concat('#', $href)">
                        <xsl:call-template name="swiftStrip">
                            <xsl:with-param name="swiftId" select="./partyId/text()"/>
                            <xsl:with-param name="payrec">
                                <xsl:text disable-output-escaping="yes">PayerSwiftcode: </xsl:text>
                            </xsl:with-param>
                            <xsl:with-param name="sspSide">
                                <xsl:text disable-output-escaping="yes">P</xsl:text>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:when>
                    <xsl:when test="$definingpath[@id=$definingleg]/receiverPartyReference/@href = concat('#', $href)">
                        <xsl:call-template name="swiftStrip">
                            <xsl:with-param name="swiftId" select="./partyId/text()"/>
                            <xsl:with-param name="payrec">
                                <xsl:text disable-output-escaping="yes">ReceiverSwiftcode: </xsl:text>
                            </xsl:with-param>
                            <xsl:with-param name="sspSide">
                                <xsl:text disable-output-escaping="yes">R</xsl:text>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:when>
                </xsl:choose>
                <xsl:text>&#xD;</xsl:text>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="getFraSwiftInformation">
        <xsl:param name="href"/>
        <xsl:param name="definingpath" select="/SWBML/swbStructuredTradeDetails/FpML/trade/fra"/>
        <xsl:choose>
            <xsl:when test="$definingpath/buyerPartyReference/@href = concat('#', $href)">
                <xsl:call-template name="swiftStrip">
                    <xsl:with-param name="swiftId" select="./partyId/text()"/>
                    <xsl:with-param name="payrec">
                        <xsl:text disable-output-escaping="yes">PayerSwiftcode: </xsl:text>
                    </xsl:with-param>
                    <xsl:with-param name="sspSide">
                        <xsl:text disable-output-escaping="yes">P</xsl:text>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:when test="$definingpath/sellerPartyReference/@href = concat('#', $href)">
                <xsl:call-template name="swiftStrip">
                    <xsl:with-param name="swiftId" select="./partyId/text()"/>
                    <xsl:with-param name="payrec">
                        <xsl:text disable-output-escaping="yes">ReceiverSwiftcode: </xsl:text>
                    </xsl:with-param>
                    <xsl:with-param name="sspSide">
                        <xsl:text disable-output-escaping="yes">R</xsl:text>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
        </xsl:choose>
        <xsl:text>&#xD;</xsl:text>
    </xsl:template>

    <xsl:template name="getCDSSwiftInformation">
        <xsl:param name="href"/>
        <xsl:param name="definingpath" select="/SWBML/swbStructuredTradeDetails/FpML/trade/creditDefaultSwap/generalTerms"/>
        <xsl:choose>
            <xsl:when test="$definingpath/buyerPartyReference/@href = $href">
                <xsl:call-template name="swiftStrip">
                    <xsl:with-param name="swiftId" select="./partyId/text()"/>
                    <xsl:with-param name="payrec">
                        <xsl:text disable-output-escaping="yes">PayerSwiftcode: </xsl:text>
                    </xsl:with-param>
                    <xsl:with-param name="sspSide">
                        <xsl:text disable-output-escaping="yes">P</xsl:text>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:when test="$definingpath/sellerPartyReference/@href = $href">
                <xsl:call-template name="swiftStrip">
                    <xsl:with-param name="swiftId" select="./partyId/text()"/>
                    <xsl:with-param name="payrec">
                        <xsl:text disable-output-escaping="yes">ReceiverSwiftcode: </xsl:text>
                    </xsl:with-param>
                    <xsl:with-param name="sspSide">
                        <xsl:text disable-output-escaping="yes">R</xsl:text>
                    </xsl:with-param>
                </xsl:call-template>
            </xsl:when>
        </xsl:choose>
        <xsl:text>&#xD;</xsl:text>
    </xsl:template>

    <xsl:template name="swiftStrip">
        <xsl:param name="swiftId"/>
        <xsl:param name="payrec"/>
        <xsl:param name="sspSide"/>
        <xsl:text disable-output-escaping="yes"></xsl:text>
        <xsl:value-of select="$payrec"/>
        <xsl:choose>

            <xsl:when test="string-length(substring-before($swiftId, 'XXX_SSP'))  > 0">
                <xsl:value-of select="substring-before($swiftId, 'XXX_SSP')"/>
                <xsl:text>&#xD;</xsl:text>

                <xsl:text disable-output-escaping="yes">SspSide: </xsl:text>
                <xsl:value-of select="$sspSide"/>
                <xsl:text>&#xD;</xsl:text>

            </xsl:when>

            <xsl:when test="string-length(substring-before($swiftId, '_SSP'))  > 0">
                <xsl:value-of select="substring-before($swiftId, '_SSP')"/>
                <xsl:text>&#xD;</xsl:text>

                <xsl:text disable-output-escaping="yes">SspSide: </xsl:text>
                <xsl:value-of select="$sspSide"/>
                <xsl:text>&#xD;</xsl:text>

            </xsl:when>

            <xsl:otherwise>
                <xsl:value-of select="$swiftId"/>
            </xsl:otherwise>

        </xsl:choose>
    </xsl:template>

</xsl:stylesheet>
0
Comment
Question by:shukla1_alok
  • 4
  • 2
7 Comments
 
LVL 1

Expert Comment

by:cdall
ID: 24798621
Could you please specify what you are trying to extract excactly and maybe boil down the XML example to suggest a structure instead of giving this very long document?
0
 

Author Comment

by:shukla1_alok
ID: 24798751
Trying to Extract following node values from the XML

<swbBrokerTradeVersionId>15</swbBrokerTradeVersionId> from the following XML Section

<swbHeader>
      <swbBrokerTradeId>ALOK4_1108299</swbBrokerTradeId>
      <swbBrokerTradeVersionId>15</swbBrokerTradeVersionId>
      <swbTradeSource>Voice</swbTradeSource>
      <swbRecipient id="_recip_1_">
            <partyReference href="partyA"/>
      </swbRecipient>
      <swbRecipient id="_recip_2_">
            <partyReference href="partyB"/>
            </swbRecipient>
</swbHeader>

Trying to apply the following templates to extract the relevant data
Regarding the participants with the help below-mentioned particiapants.

<xsl:apply-templates select="/SWBML/swbHeader/swbRecipient"/>
<xsl:apply-templates select="/SWBML/swbStructuredTradeDetails/FpML/party"/>
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24798848
You have to realise that all elements are in a namespace
because of the xmlns attribute
<SWBML xmlns="http://www.fpml.org/2005/FpML-4-2"
So you will have to address the elements in this namespace
Yo can not do that by setting this namespace to the default namespace in your stylesheet, so you will need one with a prefix.
You did that right in your stylesheet header
xmlns:fpml="http://www.fpml.org/2005/FpML-4-2"
But this means that you need to prefix every element in every single XPath expression in your stylesheet

<xsl:apply-templates select="/fpml:SWBML/fpml:swbHeader/fpml:swbRecipient"/>
it is an ugly task, but there is no other way in XSLT1
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 60

Accepted Solution

by:
Geert Bormans earned 50 total points
ID: 24798902
I did part of your stylesheet just to show you what I mean

Working on the example gave me a direct positive result
<xsl:stylesheet version="1.0"

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

    xmlns:fpml="http://www.fpml.org/2005/FpML-4-2"

    xmlns:fo="http://www.w3.org/1999/XSL/Format" >

    <xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/>

    

    <xsl:template match="/">

        <xsl:text disable-output-escaping="yes">TradeVersion: </xsl:text>

        <xsl:value-of select="fpml:SWBML/fpml:swbHeader/fpml:swbBrokerTradeVersionId"/>

        <xsl:text>&#xD;</xsl:text>

        <!--<xsl:text disable-output-escaping="yes">swbRecipient Called. </xsl:text>-->

        <xsl:apply-templates select="/fpml:SWBML/fpml:swbHeader/fpml:swbRecipient"/>

        <!--<xsl:text disable-output-escaping="yes">Party Called. </xsl:text>-->

        <xsl:apply-templates select="/fpml:SWBML/fpml:swbStructuredTradeDetails/fpml:FpML/party"/>

    </xsl:template>

    

    <xsl:template match="fpml:swbRecipient">

        <xsl:param name="href" select="./fpml:partyReference/@href"/>

        <xsl:param name="dealType" select="/fpml:SWBML/fpml:swbStructuredTradeDetails/fpml:swbProductType"/>

        <xsl:param name="definingleg" select="'fixedLeg'"/>

        <xsl:param name="definingpath" select="/fpml:SWBML/fpml:swbStructuredTradeDetails/fpml:FpML/fpml:trade/fpml:swap/fpml:swapStream"/>

        <!--<xsl:text disable-output-escaping="yes">swbRecipient In. </xsl:text>-->

        <xsl:choose>

            <xsl:when test="$dealType = 'Single Currency Basis Swap'">

                <xsl:call-template name="getRecipientInformation">

                    <xsl:with-param name="href" select="$href"/>

                    <xsl:with-param name="payer" select="/fpml:SWBML/fpml:swbStructuredTradeDetails/fpml:FpML/fpml:trade/swap/fpml:swapStreams/fpml:swapStream[@id='floatingLeg']/fpml:payerPartyReference"/>

                    <xsl:with-param name="receiver" select="/fpml:SWBML/fpml:swbStructuredTradeDetails/fpml:FpML/fpml:trade/swap/fpml:swapStreams/fpml:swapStream[@id='floatingLeg']/fpml:receiverPartyReference"/>

                </xsl:call-template>

            </xsl:when>

            

            <xsl:otherwise>

                <xsl:call-template name="getRecipientInformation">

                    <xsl:with-param name="href" select="$href"/>

                    <xsl:with-param name="payer" select="/fpml:SWBML/fpml:swbStructuredTradeDetails/fpml:FpML/fpml:trade/fpml:swap/fpml:swapStream[@id=$definingleg]/fpml:payerPartyReference"/>

                    <xsl:with-param name="receiver" select="/fpml:SWBML/fpml:swbStructuredTradeDetails/fpml:FpML/fpml:trade/fpml:swap/fpml:swapStream[@id=$definingleg]/fpml:receiverPartyReference"/>

                </xsl:call-template>

            </xsl:otherwise>

        </xsl:choose>

    </xsl:template>

...

Open in new window

0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24798911
Note that in XSLT2, you can set the default namespace for all XPaths in the stylesheet, that takes away a lot of work from this example
0
 

Author Closing Comment

by:shukla1_alok
ID: 31600825
Perfecto,  I did the same thing for something else but simply didn't pay attention. But thanks for your help.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24803321
welcome
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Xsl Nested Loop 4 21
How to I "stripe" columns using XSLT 3 30
File names with & character 6 59
replace quotes with UTF-8 character 38 68
When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now