0

I get multiple XML files into one folder.Files names and count of XML files varies every time when we run the job.So I need to write or apply a style sheet which will merge all XML files and display it as HTML page. Please suggest me to write style sheet which will process all xml files in current folder in a generic way or suggest any parser which can i use to achieve this requirement.

Note : All XML fles follow the same tree structure

I tried like

<?xml version='1.0'?>
     <xsl:stylesheet version="2.0"
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xsl:output method="html" omit-xml-declaration="yes" indent="yes"/>

<xsl:template match="node()|@*" mode="inFile">
 <xsl:copy>
   <xsl:apply-templates mode="inFile" select="node()|@*"/>
 </xsl:copy>
</xsl:template>

<xsl:template match="/">
   <xsl:apply-templates mode="inFile" select=
   "collection('file:///C:/temp?select=*_Results.xml;recurse=yes')"/>

   <xsl:apply-templates select="@* | node() " />
</xsl:template>

</xsl:stylesheet>

when I open xml file using firwfox browser error is displayed

Thanks

2
  • I have a stylesheet which can merge xmls and display as HTML. As every time file names changes i am unable to process those in generic way. started trying STAX parser. but project code is in python. Commented Oct 22, 2014 at 17:03
  • You should use the collection() function. See there : stackoverflow.com/questions/8595117/… Commented Oct 22, 2014 at 17:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.