Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XSLT function document() using wildcard

Tags:

xslt

Is there any possibility to use a wildcard for the document() function in XSLT like:

document("*.xml")

This is the same question: http://www.biglist.com/lists/xsl-list/archives/200108/msg00542.html

However this post is from 2001 so there might be any new techniques to solve this. Ideas?

like image 298
Chris Avatar asked Dec 21 '11 19:12

Chris


1 Answers

Is there any possibility to use a wildcard for the document() function

No, there aren't any such changes to the behaviour of the document() function.

However, XPath 2.0 (and that means available in XSLT 2.0) offers the standard function collection()

Its behavior is to some extent implementation dependent.

Example (based on Saxon 9):

This XPath expression:

collection('file:///c:/?select=report_*.xml')

selects the document nodes of every XML document that resides in c:\ in a file with name starting with report_ then having a 0 or more characters, then ending with .xml.

like image 95
Dimitre Novatchev Avatar answered Sep 19 '22 23:09

Dimitre Novatchev