[xsl] Collection is not working for Bulk XML

Subject: [xsl] Collection is not working for Bulk XML
From: "Rahul Singh rahulsinghindia15@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 8 Jun 2018 16:44:19 -0000
Hi,

I have bulk XML's and stored in directory *C:/Users/1289568903/Desktop/Data*
as below:

a.xml:

<?xml version="1.0" encoding="UTF-8"?>
<mailInfoData>
<mailInfo>rahuls@xxxxxxxxx</mailInfo>
</mailInfoData>
b.xml:

<?xml version="1.0" encoding="UTF-8"?>
<mailInfoData>
<mailInfo>rahult@xxxxxxxxx</mailInfo>
</mailInfoData>
c.xml:

<?xml version="1.0" encoding="UTF-8"?>
<mailInfoData>
<mailInfo>rahulc@xxxxxxxxx</mailInfo>
</mailInfoData>
I need output as below from all xml:

<mailCollect>
a.xml <mailInfo>rahuls@xxxxxxxxx</mailInfo>
b.xml <mailInfo>rahult@xxxxxxxxx</mailInfo>
c.xml <mailInfo>rahulc@xxxxxxxxx</mailInfo>
</mailCollect>

And below is my XSL code but collection is not working:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"; xmlns:fo="
http://www.w3.org/1999/XSL/Format"; xmlns:xs="
http://www.w3.org/2001/XMLSchema"; xmlns:fn="
http://www.w3.org/2005/xpath-functions";>
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:param name="DocumentsURI"
select="'file:///C:/Users/1289568903/Desktop/Data'"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<xsl:result-document href="Merged.xml" method="xml" indent="yes">
<mailCollect>
<xsl:for-each
select="collection(concat($DocumentsURI,'?select=*.xml;recurse=yes;on-error=ignore'))">
<xsl:apply-templates select="/mailInfo"/>
</xsl:for-each>
</mailCollect>
</xsl:result-document>
</xsl:template>
</xsl:stylesheet>


Thanks.

Current Thread