Re: [xsl] Merging is not working by xsl for 2 xml

Subject: Re: [xsl] Merging is not working by xsl for 2 xml
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 11 Jun 2017 11:52:23 -0000
On 11.06.2017 13:46, Rahul Singh rahulsinghindia15@xxxxxxxxx wrote:

I tried to merge 2 xml based if /objects/phone/ContactId from merge1.xml equal to /objects/Contact/Id from merge2.xml with below xsl, both xml are attached:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl=""; xmlns:p0=" <>" xmlns:xsi=""; xmlns:xs=""; exclude-result-prefixes="xs" version="2.0">
<xsl:output method="xml" indent="yes"/>
<xsl:param name="with" select="document('merge2.xml')"/>
<xsl:template match="p0:objects">
<xsl:for-each select="p0:phone">
<xsl:if test="p0:Phone_Type='Document Uploaded' or p0:Phone_Type='Document Viewed'">
<xsl:variable name="aaa" select="p0:ContactId"/>
<!--<xsl:if test="exists($aaa=$with/objects/Contact/Id)">-->
<xsl:copy-of select="$with"/>

Can you explain how you want the merged document to look? Copying the complete second document with <xsl:copy-of select="$with"/> doesn't seem like the usual merging to me.
And why is the <xsl:if test="exists($aaa=$with/objects/Contact/Id)"> trying to compare ids commented out?

Current Thread