Solved

Folder contains multiple xml files

Posted on 2009-04-06
1
223 Views
Last Modified: 2013-11-18
Hello Experts,

I would like to create an filelist by passing input folder which contains xml files and using xslt generate filelist like...

<filelist>
<file href="1.xml"/>
<file href="2.xml"/>
.....
</filelist>

Can you please suggest is this can be done using xslt?

Thanks,
Shailesh
0
Comment
Question by:ShaileshShinde
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 24076961
This can only be done if you use XSLT2.
Do you?

If you do, here is how to use Saxon for that
<?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
         exclude-result-prefixes="xsi">
        <xsl:param name="joinDir">file:/F:/10_Development/2008/Q3/</xsl:param>
        <xsl:output method="xml" indent="yes" />
        <xsl:strip-space elements="*"/>
        
        <xsl:template match="/">
            <xsl:element name="filelist">
                <xsl:for-each select="collection(concat($joinDir, '?select=*.xml'))">
                    <file href="{tokenize(base-uri(), '/')[last()]}"/>
                </xsl:for-each>
            </xsl:element>
        </xsl:template>
        
   </xsl:stylesheet>
   

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question