Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Folder contains multiple xml files

Posted on 2009-04-06
1
Medium Priority
?
227 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
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 2000 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 found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
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 how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

824 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