• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting list of non-xml files

 
tulips phan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I have a problem when using collection function for getting list of file which is on non-xml format. Please help to give me with another function or any argument with collection function.
Thanks,
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is this "collection function"?

All Java file examination starts with the java.io.File object - are you familiar with that class?

Bill
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Based on your other unrelated post, I am going to take a wild guess... this "collection" function is something in XSLT 2.0? Am I right?
 
g tsuji
Ranch Hand
Posts: 669
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First a preliminary note to clear some possible mis-interpretation: collection() is an xslt 2.0 xpath function.

Now collection() can be considered as a high-octane version of doc() or document(). With its high-performance, come with its restriction. It can be used to collect sequence of non-xml url as it expects to work with the parsing. Any ill-formedness will result in fatal error.

In order to collect an enumerated list of non-xml text file (like .ini containing name/value pairs or even csv or else...) you have to fall back to using doc() or document(). To make the most analog to the use of catalog (xml) in some implementation used with collection(), you can construct some apparently same catalog xml document and load it with doc() or document(). And then feed the href to some user-defined xsl function (or named template) designed for the specific purpose of parsing it.

For instance, let us make a catalog, say catalog.xml, of the form like this.


You could process the enumerated list of external files like this. (<doc>...</doc> wrapper is just for illustration of no generic necessity; and fn is some arbitrary namespace for user-defined xslt function main().)

With the function fn:main() looking possibly like this. (I make maximum continuity of op's previous thread to make the idea of maximum clarity.)

Then the collection will be loaded and parsed into the particular form desired for the authoring of the resultant xml.
 
tulips phan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
g tsuji wrote:First a preliminary note to clear some possible mis-interpretation: collection() is an xslt 2.0 xpath function.

Now collection() can be considered as a high-octane version of doc() or document(). With its high-performance, come with its restriction. It can be used to collect sequence of non-xml url as it expects to work with the parsing. Any ill-formedness will result in fatal error.

In order to collect an enumerated list of non-xml text file (like .ini containing name/value pairs or even csv or else...) you have to fall back to using doc() or document(). To make the most analog to the use of catalog (xml) in some implementation used with collection(), you can construct some apparently same catalog xml document and load it with doc() or document(). And then feed the href to some user-defined xsl function (or named template) designed for the specific purpose of parsing it.

For instance, let us make a catalog, say catalog.xml, of the form like this.


You could process the enumerated list of external files like this. (<doc>...</doc> wrapper is just for illustration of no generic necessity; and fn is some arbitrary namespace for user-defined xslt function main().)

With the function fn:main() looking possibly like this. (I make maximum continuity of op's previous thread to make the idea of maximum clarity.)

Then the collection will be loaded and parsed into the particular form desired for the authoring of the resultant xml.


Hi,
Sorry about implicit question and late reply :)
With the question, I mean I using collection function on XSLT that does not support to read a non-xml format file.
And I'd like to get list of file with a pattern string (ex: *.rpt,...). That means we don't know list of specify file-names which need to be read. So I'm afraid that we cannot using collection function to get nodes in input xml. At the present, I must use a wrapper perl/csh script to get list of file and calling make xml report for-each file :(. Anyone, can give me better solution?

Thank so much,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic