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

Java list extension

Subject: Java list extension
From: Geurt Lagemaat <lagemaat@xxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 05 Jul 2011 01:24:58 +0200
 Java list extension
Dear List,

I'm within some serious project boundrys so I'm left with one and only
option: copying files with XSLT. Now I solved that a while ago (with
help of this list), like:

<xsl:value-of select="java-fc:transferTo($FileChannelIn, 0, $size,
$FileChannelOut), java-fc:close($FileChannelIn),
java-fc:close($FileChannelOut)"/>

Now I need a way to discover the contents of a directory (files and
other directorys). So far I have:

<xsl:variable name="directory" select="java-file:new($sourcefileURI)"/>
<xsl:variable name="tst">  <!-- as="class:java.io.File" -->
<xsl:value-of select="for $file in java-file:list($directory) return
concat($sourcefileURI,$file)"/>
</xsl:variable>

(xmlns:java-file="java.io.File")

This works when I put $tst to output:

<xsl:variable name="fftest" select="tokenize($tst,' ')"/>
<xsl:for-each select="$fftest">

Problem is that I converted it to a ordinary string and i do need the
collection because I want to find out if a entry is a directory or not,
like:

<xsl:value-of select="java-file:isDirectory($....)"/>

Questions:

How do I type the $tst var so it behaves like a Java collection and I
can use it like a Java File collection. What I want is something like:

<xsl:variable name="dirContents">  <!-- as="class:java.io.File" ??? -->
<xsl:value-of select="for $file in java-file:list($directory) return
concat($sourcefileURI,$file)"/>
</xsl:variable>


<xsl:for-each select=$dirContents>


<xsl:choose>

<xsl:when test=java-file:isDirectory(.)>

do this

</xsl:when>

<xsl:otherwise>

just copy the file

</xsl:otherwise>

</xsl:choose>

</xsl:for-each>

Thanks.

Regards, Geurt Lagemaat

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-2013 All Rights Reserved.