[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Java list extension

Subject: Re: Java list extension
From: Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx>
Date: Tue, 5 Jul 2011 14:09:00 +0200
Re:  Java list extension
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>&#10;</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:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.