[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Filtering source XML with XSL
Hope this helps <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes" /> <xsl:param name="ExternalRefId" /> <xsl:template match="/"> <result> <xsl:copy-of select="Trades/Trade[Header/ExternalRefId = $ExternalRefId]" /> </result> </xsl:template> </xsl:stylesheet> On 10/30/07, Chanchlani, Lalit <lalit.chanchlani@xxxxxxxxxx> wrote: > Hi All, > > I have got the below source XML. I need to copy the source XML to the > output tree based on a parameter. The parameter will be the value of the > field ExternalRefId. So basically the contents of the specific <Trade> > </Trade> matching its ExternalRefId should be selected to the output. > > Can someone please advise how can I write a XSL for performing the > above? > > > <?xml version="1.0" encoding="UTF-8" standalone="yes"?> > > <Trades> > <Trade Type="DefaultSwap"> > <Header> > <OriginatingSystem>XXX</OriginatingSystem> > <ExternalRefId>SPZ3027V2</ExternalRefId> > <ActionType>New</ActionType> > <SentOn>20071022 10:25</SentOn> > <Workflow>YES</Workflow> > <SenderId>xxxxx</SenderId> > </Header> > <ReferenceObligation> > <SecurityCurrency>XXX</SecurityCurrency> > <Ticker>XXX</Ticker> > <CusipOrIS>XXX</CusipOrIS> > <SecurityId>XXDD</SecurityId> > <SecurityDesc>DDDDD</SecurityDesc> > <Issuer>ITV PLC</Issuer> > <OriginalFace>325000000.0</OriginalFace> > <RateType>FIXED</RateType> > <Coupon>5.375</Coupon> > <SecurityMaturity>20151019</SecurityMaturity> > <SecurityPurpose>BOOKING ONLY</SecurityPurpose> > <IssueDate>20051019</IssueDate> > <FirstCouponDate>20061019</FirstCouponDate> > <LastCouponDate>20141019</LastCouponDate> > <IssuerCountry>GB</IssuerCountry> > <ReferenceEntityId>GKDHCEAC8</ReferenceEntityId> > </ReferenceObligation> > <BookingInfo> > <Books> > <Book> > <BookName>NODCCDS</BookName> > <BookingSystem>CDS</BookingSystem> > <BookingDesk>44446</BookingDesk> > </Book> > </Books> > <FlowFlag>Easy</FlowFlag> > <LegRole>All</LegRole> > </BookingInfo> > </Trade> > <Trade Type="DefaultSwap"> > <Header> > <OriginatingSystem>YYY</OriginatingSystem> > <ExternalRefId>SPZ3027U4</ExternalRefId> > <ActionType>New</ActionType> > <SentOn>20071022 10:25</SentOn> > <Workflow>YES</Workflow> > <SenderId>xxx</SenderId> > </Header> > <ReferenceObligation> > <SecurityCurrency>GBP</SecurityCurrency> > <Ticker>ITV</Ticker> > <CusipOrISIN>RED</CusipOrISIN> > <SecurityId>XS0232037233</SecurityId> > <SecurityDesc>ITVLN 5 3/8 10/19/15</SecurityDesc> > <Issuer>ITV PLC</Issuer> > <OriginalFace>325000000.0</OriginalFace> > <RateType>FIXED</RateType> > <Coupon>5.375</Coupon> > <SecurityMaturity>20151019</SecurityMaturity> > <SecurityPurpose>BOOKING ONLY</SecurityPurpose> > <IssueDate>20051019</IssueDate> > <FirstCouponDate>20061019</FirstCouponDate> > <LastCouponDate>20141019</LastCouponDate> > <IssuerCountry>GB</IssuerCountry> > <ReferenceEntityId>GKDHCEAC8</ReferenceEntityId> > </ReferenceObligation> > <PaymentBusinessCenters> > <PaymentBusinessCenter1>London</PaymentBusinessCenter1> > <PaymentBusinessCenter2>New York</PaymentBusinessCenter2> > </PaymentBusinessCenters> > </Trade> > </Trades> > > Regards, > Lalit -- Regards, Mukul Gandhi
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|