xsl-list
[Top] [All Lists]

RE: [xsl] Filtering source XML with XSL

2007-10-30 04:04:04
I set it up as below:

<?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" select="'SPZ3027V2'"/>

  <xsl:template match="/">
    <result>
        <xsl:copy-of select="Trades/Trade[Header/ExternalRefId =
$ExternalRefId]" />
    </result>
  </xsl:template>
        
</xsl:stylesheet>

But still getting the same output:

<?xml version="1.0" encoding="UTF-8"?>
<result/> 

I am using Java on Eclipse. 

Transformer xmlTransformer =
transformerFactory.newTransformer(xmlSource);
DocumentBuilderFactory xmlFactory =
DocumentBuilderFactory.newInstance();
DocumentBuilder xmlBuilder = xmlFactory.newDocumentBuilder();
Document xmlDocument = xmlBuilder.parse( new File("skt_trade.xml") );
DOMSource source1 = new DOMSource(xmlDocument);
StreamResult result1 = new StreamResult(System.out);
xmlTransformer.setParameter("ExternalRefId", token);
xmlTransformer.transform(source1, result1);


-----Original Message-----
From: Joe Fawcett [mailto:joefawcett(_at_)hotmail(_dot_)com] 
Sent: Tuesday, October 30, 2007 4:26 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Filtering source XML with XSL

The carriage return looks suspicious. Try this one:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">

  <xsl:output method="xml" indent="yes" />

  <xsl:param name="ExternalRefId" select="'SPZ3027V2'"/>

  <xsl:template match="/">
    <result>
      <xsl:copy-of select="Trades/Trade[Header/ExternalRefId =
$ExternalRefId]" />
    </result>
  </xsl:template>

</xsl:stylesheet>

If that works then there's a problem with setting the parameter. What
environment are you using and how are you setting it?

Joe


From: "Chanchlani, Lalit" <lalit(_dot_)chanchlani(_at_)lehman(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: RE: [xsl] Filtering source XML with XSL
Date: Tue, 30 Oct 2007 16:10:16 +0530

Following is the result I get after setting the param value.

<?xml version="1.0" encoding="UTF-8"?>
<result>
  SPZ3027V2</result>

Also, there is no DTD reference / namespace declarations for the XML.

Regards,
Lalit


-----Original Message-----
From: Joe Fawcett [mailto:joefawcett(_at_)hotmail(_dot_)com]
Sent: Tuesday, October 30, 2007 3:59 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Filtering source XML with XSL

Are you sure you set the param ExternalRefId? Suggest you add 
<xsl:value-of select="$ExternalRefId" /> just after the <result> tag.

Are you sure you haven't simplified the example by removing namespace 
declarations or a DTD reference?

Joe
http://joe.fawcett.name


From: "Chanchlani, Lalit" <lalit(_dot_)chanchlani(_at_)lehman(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: RE: [xsl] Filtering source XML with XSL
Date: Tue, 30 Oct 2007 15:52:00 +0530

Hi Mukul,

I tried with the XSL you provided. But I am getting the output as:

<?xml version="1.0" encoding="UTF-8"?> <result/>

I have also put the value of ExternalRefId. Can you please help?

Regards,
Lalit

-----Original Message-----
From: Mukul Gandhi [mailto:gandhi(_dot_)mukul(_at_)gmail(_dot_)com]
Sent: Tuesday, October 30, 2007 2:23 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] 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(_dot_)chanchlani(_at_)lehman(_dot_)com> 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-

- -
- - - - - -

This message is intended only for the personal and confidential use 
of the designated recipient(s) named above.  If you are not the 
intended recipient of this message you are hereby notified that any 
review, dissemination, distribution or copying of this message is 
strictly prohibited.  This communication is for information purposes 
only and should not be regarded as an offer to sell or as a 
solicitation of an offer to buy any financial product, an official 
confirmation of any transaction, or as an official statement of 
Lehman Brothers.  Email transmission cannot be guaranteed to be
secure or error-free.
Therefore, we do not represent that this information is complete or 
accurate and it should not be relied upon as such.  All information 
is
subject to change without notice.


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- -
- - - - - -

This message is intended only for the personal and confidential use of 
the designated recipient(s) named above.  If you are not the intended 
recipient of this message you are hereby notified that any review, 
dissemination, distribution or copying of this message is strictly 
prohibited.  This communication is for information purposes only and 
should not be regarded as an offer to sell or as a solicitation of an 
offer to buy any financial product, an official confirmation of any 
transaction, or as an official statement of Lehman Brothers.  Email 
transmission cannot be guaranteed to be secure or error-free.  
Therefore, we do not represent that this information is complete or 
accurate and it should not be relied upon as such.  All information is
subject to change without notice.


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - - -

This message is intended only for the personal and confidential use of the 
designated recipient(s) named above.  If you are not the intended recipient of 
this message you are hereby notified that any review, dissemination, 
distribution or copying of this message is strictly prohibited.  This 
communication is for information purposes only and should not be regarded as an 
offer to sell or as a solicitation of an offer to buy any financial product, an 
official confirmation of any transaction, or as an official statement of Lehman 
Brothers.  Email transmission cannot be guaranteed to be secure or error-free.  
Therefore, we do not represent that this information is complete or accurate 
and it should not be relied upon as such.  All information is subject to change 
without notice.


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--