Issue - need a directory listing of xml files using purely XSLT
Resolution - create an XSLT with the following code, name this as lister.xsl and use the Saxon initial template option -it to call the template
java -jar saxon.jar -it:lister -xsl:lister.xsl -o:filelist.xml
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:template name="lister">
<fileList>
<xsl:for-each
select="collection('./?select=*.xml;recurse=yes;on-error=warning')" >
<xsl:element name='file'>
<xsl:attribute name="full" select="document-uri(.)"/>
<xsl:value-of select="tokenize(document-uri(.), '/')[last()]"/>
</xsl:element>
</xsl:for-each>
</fileList>
</xsl:template>
</xsl:stylesheet>
No comments:
Post a Comment