Looping over a set of files or directories

Previous Next

To loop over a set or files or directories, you can use the following 2 directives. This particular example simply outputs a list of filenames.

<pc:assign-nodeset textfiles="{.}">
   <pc:Directory filepath="c:\temp" select="Directory/File" filter="*.xml"/>
</pc:assign-nodeset>
<pc:each select="$textfiles" assign:result="@filename">
     <pc:value-of select="$result"/><pc:newline/>
</pc:each>