Solved

Folder contains multiple xml files

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to dynamically set the form action using jQuery.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now