xsl-list
[Top] [All Lists]

[xsl] Java list extension

2011-07-04 18:25:15
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



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>