|
Subject: Re: [xsl] collection is not working From: "Flanders, Charles E (US) charles.flanders@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 2 Apr 2018 19:39:39 -0000 |
I think you have your parameter and use of the collection function backwards.
Is ARB a folder name that contains the 100 XML files? If so, you want to
define your parameter (using the collection function) as:
<xsl:param name="DocumentsURI"
select="'collection(file:/C:/Users/rahul/Downloads/ARB/ARB/?select=*.xml)"/>
Then, the for the for-each is the parameter $DocumentsURI
From: Rahul Singh rahulsinghindia15@xxxxxxxxx
[mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx]
Sent: Monday, April 02, 2018 12:40 PM
To: XSL-List: The Open Forum on XSL; xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] collection is not working
*** WARNING ***
EXTERNAL EMAIL -- This message originates from outside our organization.
Hi,
I have 100 xml file which contains xml data with schemalocation namespace in
root element, i have written xslt to merge file name with schema name in one
file but i am not able to generate my output :
Input:
aa.xml
<?xml version="1.0" encoding="UTF-8"?>
<article xsi:noSchemaLocation="aa.xsd">
<name>aaas</name>
</article>
bb.xml
<?xml version="1.0" encoding="UTF-8"?>
<article xsi:noSchemaLocation="bb.xsd">
<name>ars</name>
</article>
cc.xml
<?xml version="1.0" encoding="UTF-8"?>
<article> xsi:noSchemaLocation="cc.xsd"
<name>tytu</name>
</article>
Expected output:
Filename Schema name
aa.xml aa.xsd
bb.xml bb.xsd
cc.xml cc.xsd
code:
<?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/rahul/Downloads/ARB/ARB'"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<!--Generating Result Docuemnt-->
<xsl:result-document href="Merged.xml" method="xml" indent="yes">
<Articles>
<xsl:for-each
select="collection(concat($DocumentsURI,'?select=*.xml;recurse=yes;on-error=i
gnore'))">
<xsl:apply-templates select="/article"/>
</xsl:for-each>
</Articles>
</xsl:result-document>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<-list/509596> (by email<>)
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] collection is not working, Rahul Singh rahulsin | Thread | Re: [xsl] collection is not working, Mukul Gandhi gandhi. |
| [xsl] collection is not working, Rahul Singh rahulsin | Date | Re: [xsl] collection is not working, Mukul Gandhi gandhi. |
| Month |