Solved

Folder contains multiple xml files

Posted on 2009-04-06
1
225 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
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 …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

626 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