Experiencing
problems with Xalan's redirect extension.
The code attached is
from the Xalan docs describing the extension.
Issue: data
directed to the file is not captured in the file. The file is created, but
empty.
Notes: bsf.jar and
bsfengines.jar from IBM are required in the classpath to use this
extension.
Things work from the
command line:
java
org.apache.xalan.xslt.Process -IN foo.xml -XSL foo.xsl -OUT
foo1.out
Note: when running
from the command line the Cocoon PI in foo.xml was not
present.
From within the
Cocoon process the output file is created but empty.
Cocoon
files:
foo.xml
<?xml
version="1.0"?>
<?cocoon-process
type="xslt"?>
<?xml-stylesheet href=""
type="text/xsl"?>
<doc>
<foo file="C:\temp\foo.out">
Testing Redirect
extension:
<bar>A foo subelement text
node</bar>
</foo>
<main>
Everything else
</main>
</doc>
foo.xsl
<?xml
version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
extension-element-prefixes="redirect">
<xsl:template match="/">
<standard-out>
Standard
output:
<xsl:apply-templates/>
</standard-out>
</xsl:template>
<xsl:template match="main">
<main>
<xsl:apply-templates/>
</main>
</xsl:template>
<xsl:template match="/doc/foo">
<redirect:write
select="@file">
<foo-out>
<xsl:apply-templates/>
</foo-out>
</redirect:write>
</xsl:template>
<xsl:template match="bar">
<foobar-out>
<xsl:apply-templates/>
</foobar-out>
</xsl:template>
</xsl:stylesheet>
Joel Hughes
ph: 905-625-8235