I am working with xslt 1.0 and trying to use the XSLT document function to apply the stylesheet to a hierarchy of folders. The folder structures is as below, but I cannot seem to find any reliable references on the Web on how to do this.
a/
└── b
└── c
├── d
├── e
├── f
Is there a way I can apply my stylesheet to nodes, in a file, in folder f via a file in folder a (a has links to file names in folder hierarchy).
Update #2
book01.xml
<?xml version="1.0" encoding="utf-8" ?>
<book location="../collection/book01.xml">
<chapter>chapter001</chapteer>
</book>
chapter01.xml
<?xml version="1.0" encoding="utf-8" ?>
<chapter location="../collection/book01/chapter01.xml">
<page>page01</page>
</chapter>
page01.xml
<?xml version="1.0" encoding="utf-8" ?>
<page location="../collection/book01/chapter01/page01.xml">
<pagenumber>page 1</pagenumber>
<text>
page one.
</text>
</page>
Output
Book Name: Book XX
Chapter XX
Page XX
page xx.
I’m not sure this is a feasable/reasonable way to implement what you want achieve in the context of your use case; however, you can stay with you initial plan, that is working with
xsl:for-eachanddocument().For example, assume you have the input file with the list of paths:
This input can be reasonably used to define a variable containing all your input documents and apply templates:
Notice that I needed the extension function in order to evaluate to a node-set. This is definetly available in xsltproc, or you can get it from EXSLT anyway.
In the example I’ve assumed that the input file is in the same folder of the book001.xml and chapter001.xml file.