Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML file collection into one HTML page 1

Status
Not open for further replies.

evaleah

Programmer
Mar 18, 2003
252
US
Can anyone point me in a direction of how to get started or where to find good information on this?

I have several hundred tiny XML files. I would like to combine them all into one using an XSLT stylesheet so a user can access all the information in all the individual files from one master HTML page. Is there a way to do this?

Thank you,
Eva
 
Create one more XML document that contains references to each of the 'tiny XML [documents]', then use that XML document as the XSLT input. Hint: you will use the XSLT document() function at the beginning of an XPath expression.

Tom Morrison
 
I don't want to have to refer to each and every file in the new XML document. That is what I am trying to avoid. There are hundreds of these and they will change frequently. All the files I want to include are named similarly CDR*.xml. Is there anyway to loop through the directory and build the master xml page dynamically?

This was actually my question. In other words, I do NOT want to have to go through the list of files and refer to each one individually.

Thank you!!!

Eva
 
This still means I have to point to a specific filename. Is there anyway to do this for all files in a given directory with a specific attribute?

Thanks,
Eva
 
Eva,

The answer you are seeking is already in this thread. You reject the suggestion, so the answer is, "No."

Now, unless you are going to wave a magic wand, I expect that there is some command (i.e. shell command) or other mechanism that will be used to summon the XSLT processor. Could not the immediately preceding step be to create the suggested XML document that contains references to all the other documents? XPath just does not cross the boundary between document and file system in the manner you desire, viz wild card processing applied to URIs (which you are equating to files).

Perhaps you could write an extension function to accomplish this all within the context of XSLT, but you might find that more trouble than it is worth.

Tom Morrison
 
Periodically run a script to get the directory's information into an xml file with all the pertinent data. Then when you want to document() to a selection of files, those data are extracted from the said xml with conditions as set by some xpath to them. In this scenario, you don't need to have a fixed set of file names to link to.
 
tsuji,

Thank you so much for all your follow up and suggestions. I was sad to find I had to run a script but the links you sent me and the ideas were excellent and got my brain working in a the right way to get the problem solved.

In the end I am running a script that reads all the files in the folder into a master xml document and then I am transforming the master. I would never have gotten there without your assistance.

THANK YOU!!!!

Eva
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top