Subject: Re: [xsl] Java list extension From: Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx> Date: Tue, 5 Jul 2011 14:23:30 +0200 |
> probeer select=*.xml thanks, but that would miss "*.xsl". And the question I would like to get answered is, whether it is possible in XSLT 2 (or XSLT 3) to get the names of Non-XML files by the stylesheet, too. Mit besten Gruessen / Best wishes, Hermann Stamm-Wilbrandt Developer, XML Compiler, L3 Fixpack team lead WebSphere DataPower SOA Appliances https://www.ibm.com/developerworks/mydeveloperworks/blogs/HermannSW/ ---------------------------------------------------------------------- IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Dirk Wittkopp Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 From: Michel Hendriksen <michel.hendriksen@xxxxx> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Date: 07/05/2011 02:16 PM Subject: Re: [xsl] Java list extension probeer select=*.xml On Tue, Jul 5, 2011 at 2:14 PM, Michel Hendriksen <michel.hendriksen@xxxxx> wrote: > > probeer select=*.xml > > On Tue, Jul 5, 2011 at 2:09 PM, Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx> wrote: >> >> Andew, >> >> > You can get a list of all the files in the directory and >> > subdirectories by doing: >> >> > <xsl:for-each >> select="collection('file:///path/to/dir/?select=*;recurse=yes;on-error=ignore')"> >> > <xsl:value-of select="document-uri(.)"/> >> >> how can you get the names of non-XML files? >> Saxon reports errors for applying document-uri() to Non-XML files. >> >> [stammw@br8ggx73 xslt20]$ ll >> total 12 >> -rw-rw-r-- 1 stammw stammw 403 Jul 5 14:04 ls.xsl >> -rw-rw-r-- 1 stammw stammw 5 Jul 5 14:03 some.xml >> -rw-rw-r-- 1 stammw stammw 4 Jul 5 14:04 tst.txt >> [stammw@br8ggx73 xslt20]$ >> [stammw@br8ggx73 xslt20]$ saxon ls.xsl some.xml >> Error on line 1 column 1 of tst.txt: >> SXXP0003: Error reported by XML parser: Content is not allowed in >> prolog. >> file:/home/stammw/xslt/xslt20/ls.xsl >> file:/home/stammw/xslt/xslt20/some.xml >> [stammw@br8ggx73 xslt20]$ >> [stammw@br8ggx73 xslt20]$ cat ls.xsl >> <xsl:stylesheet version="2.0" >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >> > >> <xsl:output omit-xml-declaration="yes" /> >> >> <xsl:template match="/"> >> <xsl:for-each >> select="collection('file:///home/stammw/xslt/xslt20/?select=*;recurse=yes;on-error=ignore')"> >> <xsl:value-of select="document-uri(.)"/><xsl:text> </xsl:text> >> </xsl:for-each> >> </xsl:template> >> >> </xsl:stylesheet> >> [stammw@br8ggx73 xslt20]$ >> >> >> Mit besten Gruessen / Best wishes, >> >> Hermann Stamm-Wilbrandt >> Developer, XML Compiler, L3 >> Fixpack team lead >> WebSphere DataPower SOA Appliances >> https://www.ibm.com/developerworks/mydeveloperworks/blogs/HermannSW/ >> ---------------------------------------------------------------------- >> IBM Deutschland Research & Development GmbH >> Vorsitzender des Aufsichtsrats: Martin Jetter >> Geschaeftsfuehrung: Dirk Wittkopp >> Sitz der Gesellschaft: Boeblingen >> Registergericht: Amtsgericht Stuttgart, HRB 243294 >> >> >> >> From: Andrew Welch <andrew.j.welch@xxxxxxxxx> >> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx >> Date: 07/05/2011 10:15 AM >> Subject: Re: [xsl] Java list extension >> >> >> >> > Now I need a way to discover the contents of a directory (files and >> > other directorys). So far I have: >> >> You can get a list of all the files in the directory and >> subdirectories by doing: >> >> <xsl:for-each >> select="collection('file:///path/to/dir/?select=*;recurse=yes;on-error=ignore')"> >> <xsl:value-of select="document-uri(.)"/> >> >> >> -- >> Andrew Welch >> http://andrewjwelch.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Java list extension, Michel Hendriksen | Thread | Re: [xsl] Java list extension, Michel Hendriksen |
Re: [xsl] Java list extension, Michel Hendriksen | Date | Re: [xsl] Java list extension, Andrew Welch |
Month |