Here is perhaps the simplest example of processing all xml files in a file system subtree (using the collection()
function implemented in Saxon):
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:template match="node()|@*" mode="inFile"> <xsl:copy> <xsl:apply-templates mode="inFile" select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="/"> <xsl:apply-templates mode="inFile" select= "collection('file:///C:/temp?select=*.xml;recurse=yes')"/> </xsl:template> </xsl:stylesheet>
When applied to any XML document (not used, ignored), this transformation applies an identification rule to each XML document contained in any of the *.xml
in the C:/Temp
subtree of the file system.
To make more unnecessary processing, you need to redefine the authentication template - in inFile
mode.
In your particular case, I believe that you can simply replace :
<xsl:apply-templates select="/testResults/result/tables/table[14]">
from
<xsl:apply-templates select="./testResults/result/tables/table[14]">
and this will apply the desired patterns on the nodes selected from the current (document) node.
Dimitre novatchev
source share