[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Copy a binary file using Java extension
Hi,
I'm trying to copy a binary file using XSLT (2) (Saxon8) with java extensions. I know I can use xmlns:fos="java.io.FileOutputStream", xmlns:file="java.io.File" to write functions like <xsl:variable name="testfile" select="file:new(resolve-uri($filename))"/> <xsl:choose> <xsl:when test="not(file:exists($testfile))"> <xsl:value-of select="false()"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="true()"/> </xsl:otherwise> </xsl:choose> and <xsl:variable name="fos" select="fos:new($ImgFilePath)"/> <!-- de base64 content as string --> <xsl:variable name="b64" select="b64:new(string(image/binair))"/> <!-- write to filestream while converting base64 to binary --> <xsl:value-of select="fos:write($fos, b64:getBinaryValue($b64))"/> <xsl:value-of select="fos:close($fos)"/> But I cant rework these fragments to a functional copyFile. Problem is there is no simple binary fileCopy available without opening streams etc. So the most obvious way is to work with the fos, but how to read a binary file in a way that fos can write it? Another idea was to use the java.io.File renameTo , but I cant translate the Java code is a XSLT way to do it. Anyone has a idea? I don't want to use a Java class because the target environment is a sort of restricted area with no access to classpaths etc (I'm suspecting trouble with the classpath if I want to use a Java class to get this functionality). Regards, Geurt Lagemaat
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|