Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 354413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:55:18+00:00 2026-05-12T11:55:18+00:00

I have a directory of XML files… for example: result.xml result2.xml result3.xml resultNth.xml (because

  • 0

I have a directory of XML files… for example:

   result.xml
   result2.xml
   result3.xml
   resultNth.xml (because there is an unknown amount of files)

the schema in each result file would be the same essentially

    <Succeeded>
          <someStrongXMLObject>

          </someStrongXMLObject>
    </Succeeded>

My Question is – can I include 1 additional XML File called results.xml in that directory… and an XSL file that will format the results…

I want to create a summary from all the result files… so that data from all these files will be included in the summary.

Is this possible? Without using any C# – just standard XML, XSLT?

Update

I don’t expect a solution, just a nod, yes its possible, or a resounding no.. I need to implement some C#. Also I would like the directory structure to be YYYY/MM/DD – so that I can have summary XML files, that will recurse thought sub directories… and create monthly and annual summaries.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:55:18+00:00Added an answer on May 12, 2026 at 11:55 am

    Yes, it is definitely possible.

    How easy it is will depend on how reliable your filename and folder name patters are. You can use the document() function to check for the presence of a result file. Use recursion to keep looking for the next sequentially named file until you reach the end.

    From your example filenames, the following XSLT could be used:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
        <xsl:template match="/">
            <summary>
                <xsl:call-template name="getResults">
                    <!--First call, use empty index -->
                    <xsl:with-param name="index" />
                </xsl:call-template>
            </summary>
        </xsl:template>
    
        <xsl:template name="getResults">
            <xsl:param name="index" />
            <xsl:variable name="filename">
                <xsl:choose>
                    <xsl:when test="$index =''">
                        <xsl:value-of select="concat('result', '.xml')" />
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="concat('result', $index, '.xml')" />
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <xsl:choose>
                <!--Check for the presence of the file -->
                <xsl:when test="document($filename)">
                    <!--If it exists, then output something from the document-->
                    <Result>
                        <xsl:attribute name="href">
                            <xsl:value-of select="$filename" />
                        </xsl:attribute>
                        <xsl:copy-of select="document($filename)/Succeeded" />
                    </Result>
                    <!--Then, call the function with a new index value to look for the next file-->
                    <xsl:call-template name="getResults">
                        <xsl:with-param name="index">
                            <xsl:choose>
                                <!--If empty index, start at 1 -->
                                <xsl:when test="$index=''">
                                    <xsl:value-of select="1" />
                                </xsl:when>
                                <xsl:otherwise>
                                    <!--Add 1 to the previous index value -->
                                    <xsl:value-of select="number($index+1)" />
                                </xsl:otherwise>
                            </xsl:choose>
                        </xsl:with-param>
                    </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:comment>Done looking for Results. Found <xsl:value-of select="number($index)" /> files.</xsl:comment>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>
    
    </xsl:stylesheet>
    

    I ran it with 3 result documents in the same folder as the XSLT(i.e. result.xml, result1.xml, result2.xml) and produced the following output:

    <?xml version="1.0" encoding="utf-8"?>
    <summary>
    <Result href="result.xml">
    <Succeeded>
            <someStrongXMLObject>
    
            </someStrongXMLObject>
        </Succeeded>
    </Result>
    <Result href="result1.xml">
    <Succeeded>
            <someStrongXMLObject>
    
            </someStrongXMLObject>
        </Succeeded>
    </Result>
    <Result href="result2.xml">
    <Succeeded>
            <someStrongXMLObject>
    
            </someStrongXMLObject>
        </Succeeded>
    </Result>
    <!--Done looking for Results. Found 3 files.-->
    </summary>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a directory with XML files. I quickly want to go through them
I have a directory of very large XML files with a structure as this:
I have a Ruby program that zips a directory tree of XML files using
I have a directory of large xml files with the following setup: <io:InfoObjects xmlns:crole="http://enterprise.businessobjects.com/3.0/customrole"
I have a directory full (~10 3 , 10 4 ) of XML files
I have XML files in a directory that I wish to get over to
I have a directory containing folders and subfolders. These subfolders contain, for example, .xml
I have a directory with about 4500 XML (HTML5) files, and I want to
I have some xml files in a directory , so I am searching required
I have many XML files in a directory that need to sorted and merged

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.