[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Compare 2 XML and call id in main xml in sucess is

Subject: Re: Compare 2 XML and call id in main xml in sucess is true
From: "Flynn, Peter pflynn@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Sep 2016 09:03:04 -0000
Re:  Compare 2 XML and call id in main xml in sucess is
On 21/09/16 20:23, Rahul Singh rahulsinghindia15@xxxxxxxxx wrote:
> Hi,
>
> I have 2 XML. result.XML and name.xml. I am comparing both XML and
> calling with corresponding XML from result.xml to name.xml if
> sucess=true case. And if sucess =false case , i need corresponding XML
> chunk from name.xml.

You don't say what the condition for a match is. If you are just
comparing result[position()] to Name[position()] then I don't see where
there is a need for a true/false test.

///Peter

> *result.xml:*
>
> <?xml version="1.0" encoding="UTF-8"?>
> <results>
>    <result>
>         <id>001R0000018j3KBIAY</id>
>         <success>true</success>
>      </result>
>    <result>
>         <id>001R0000018j3KCIAY</id>
>         <success>true</success>
>      </result>
>    <result>
>         <id>001R0000018j3KDIAY</id>
>         <success>true</success>
>      </result>
>    <result>
>         <id>001R0000018j3KEIAY</id>
>         <success>true</success>
>      </result>
>    <result>
>         <id xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
> <http://www.w3.org/2001/XMLSchema-instance>" xsi:nil="true"/>
>         <success>false</success>
>      </result>
>     <result>
>         <id>001R0000018j3KFIAY</id>
>         <success>true</success>
>      </result>
> </results>
>
> *Name.xml:*
>
>
> <Names>
>    <Name>
>       <LAST_NAME>rtt</LAST_NAME>
>       <FIRST_NAME>ds</FIRST_NAME>
>    </Name>
>    <Name>
>       <LAST_NAME>jhj</LAST_NAME>
>       <FIRST_NAME>tyt</FIRST_NAME>
>    </Name>
>    <Name>
>       <LAST_NAME>qwqw</LAST_NAME>
>       <FIRST_NAME>i</FIRST_NAME>
>    </Name>
>    <Name>
>       <LAST_NAME>trt</LAST_NAME>
>       <FIRST_NAME>ss</FIRST_NAME>
>    </Name>
>    <Name>
>       <LAST_NAME>yt</LAST_NAME>
>       <FIRST_NAME>asa</FIRST_NAME>
>    </Name>
> </Names>
>
>
> *XSLT: *
>
> <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform
> <http://www.w3.org/1999/XSL/Transform>">
>     <xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
>     <xsl:strip-space elements="*"/>
>     <xsl:param name="tranFile" select="document('Name.xml')"/>
>
>     <xsl:template mode="insert" match="Names">
>         <xsl:copy-of select="../../Name"/>
>     </xsl:template>
>
>     <xsl:template match="@* | node()">
>         <xsl:copy>
>             <xsl:apply-templates select="@*"/>
>             <xsl:apply-templates mode="insert" select="."/>
>             <xsl:apply-templates mode="inserta" select="."/>
>             <xsl:apply-templates/>
>         </xsl:copy>
>     </xsl:template>
>
>     <xsl:template mode="insert" match="*"/>
>     <xsl:template mode="inserta" match="*"/>
>
>
>     <xsl:template match="@* | node()">
>         <xsl:copy>
>             <xsl:apply-templates select="@* | node()"/>
>         </xsl:copy>
>     </xsl:template>
> </xsl:stylesheet>
>
>
> *Expected Output:*
>
>
> <Names>
>    <Name>
>       <LAST_NAME>rtt</LAST_NAME>
>       <FIRST_NAME>ds</FIRST_NAME>
>   <id>001R0000018j3KBIAY</id>
>    </Name>
> ....
> ....
>
> </Names>
>
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <-list/643318>
> (by email <>)


///Peter
--
Peter Flynn | Academic & Collaborative Technologies | University College
Cork IT Services | b +353 21 490 2609 | b	 pflynn@xxxxxx | p
 www.ucc.ie

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.