You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Andrea Schneider <as...@insos.com> on 2000/01/17 17:21:42 UTC

Problems with redirect

Hello,
can anybody help and say me what's wrong:
I have problems with multiple output. Last I used a simple example:

The xml-file:
<?xml version="1.0" encoding="UTF-8"?>
<doc><foo>Hello</foo></doc>  

The xsl-file:
<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:output method="html"/>
   <xsl:template match="/">
   <xsl:variable name="file" select="/home/as/XML/doc1.out"/>
   <!--
   <redirect:open file="$file"/>
   -->
   <redirect:write file="$file">

   <xsl:for-each select="doc">
     <HTML>
     <BODY>
       <xsl:value-of select="foo"/>
      </BODY>
      </HTML>
   </xsl:for-each>

   </redirect:write>
   <!--
   <redirect:close file="$file"/>
   -->
   </xsl:template>
  </xsl:stylesheet>

When I include the redirect:open and close-instructions I get the
following Exception:

"Call to extension function failed: method call/new failed:
java.lang.reflect.InvocationTargetException target exception: write
error"

When I run it like the above example the file doc1.out exists but with
no content.                   
This behavior is the same with call from api or command-line.(I used
xalan_0_19_2)

If anybody has an idea or can tell me that this is a well-known problem
and on your
ToDo-List I will be happy.

Thanks
-Andrea

PLEASE: apply this patch to CVS (was Re: Problems with redirect)

Posted by Andreas Voss <an...@avix.rhein-neckar.de>.
Andrea,

attached a patch that fixes the "empty-output-files" problem. I've posted
this patch several times to this list, but somehow it didn't make its way
into CVS.

Andreas


On Mon, 17 Jan 2000, Andrea Schneider wrote:

> Date: Mon, 17 Jan 2000 17:21:42 +0100
> From: Andrea Schneider <as...@insos.com>
> Reply-To: xalan-dev@xml.apache.org
> To: xalan-dev@xml.apache.org
> Subject: Problems with redirect
> 
> Hello,
> can anybody help and say me what's wrong:
> I have problems with multiple output. Last I used a simple example:
> 
> The xml-file:
> <?xml version="1.0" encoding="UTF-8"?>
> <doc><foo>Hello</foo></doc>  
> 
> The xsl-file:
> <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:output method="html"/>
>    <xsl:template match="/">
>    <xsl:variable name="file" select="/home/as/XML/doc1.out"/>
>    <!--
>    <redirect:open file="$file"/>
>    -->
>    <redirect:write file="$file">
> 
>    <xsl:for-each select="doc">
>      <HTML>
>      <BODY>
>        <xsl:value-of select="foo"/>
>       </BODY>
>       </HTML>
>    </xsl:for-each>
> 
>    </redirect:write>
>    <!--
>    <redirect:close file="$file"/>
>    -->
>    </xsl:template>
>   </xsl:stylesheet>
> 
> When I include the redirect:open and close-instructions I get the
> following Exception:
> 
> "Call to extension function failed: method call/new failed:
> java.lang.reflect.InvocationTargetException target exception: write
> error"
> 
> When I run it like the above example the file doc1.out exists but with
> no content.                   
> This behavior is the same with call from api or command-line.(I used
> xalan_0_19_2)
> 
> If anybody has an idea or can tell me that this is a well-known problem
> and on your
> ToDo-List I will be happy.
> 
> Thanks
> -Andrea
>