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

Output redirection in LotusXSL/xalan: using a variable?

Subject: Output redirection in LotusXSL/xalan: using a variable?
From: Wolfgang May <may@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 5 Jul 2000 16:52:39 +0200 (MET DST)
mondial malta
Is it possible to use an xsl:variable for output redirection with
LotusXSL/xalan?

I am trying to compute the name of the output file in the
xslt-stylesheet. This works with xt, but not for LotusXSL:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
                xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
                extension-element-prefixes="redirect">;

<xsl:output method="xml" indent="yes"/>

<xsl:template match="mondial">
  <xsl:variable name="output_file_name">
    <xsl:choose>
      <xsl:when test="@restrictions">
        <xsl:variable name="restrictions" select="@restrictions"/>
        <xsl:value-of select="concat('mondial-',$restrictions,'-2.0.xml')"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'mondial-2.0.xml'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <redirect:write select="{$output_file_name}">;
<!--                       ^^^^^^^^^^^^^^^^^^  
  the following works:    
   <redirect:write select="@restriction">;
  or, with xt:
   <xt:document href="{$output_file_name}">       -->

  <xsl:text disable-output-escaping="yes">
       &lt;!DOCTYPE mondial SYSTEM "mondial-2.0.dtd"&gt;
  </xsl:text>
  <mondial>
  <xsl:apply-templates select="*"/>
  </mondial>
  </redirect:write>
<!--   </xt:document> -->
</xsl:template>

*** the input file

<mondial restrictions="europe">

<continent id="europe">
   <name>Europe</name>
   <area>9562488</area>
</continent>

...

</mondial>

, so $output_file_name above should have the value
"mondial-europe-2.0.xml", but I get ...

*** the error message:

malta:~/tmp> java org.apache.xalan.xslt.Process -in mondial-europe-flat.xml -xsl mondial-2.0.xsl
========= Parsing file:/home/may/tmp/mondial-2.0.xsl ==========
Parse of file:/home/may/tmp/mondial-2.0.xsl took 1242 milliseconds
========= Parsing mondial-europe-flat.xml ==========
Parse of mondial-europe-flat.xml took 3871 milliseconds
=============================
Transforming...
XSL Error: Redirect extension: Could not get filename - file or select attribute must return vald string., style tree node: org.apache.xalan.xslt.ElemExtensionCall@1fa51967, source tree node: mondial
Call to extension function failed: method call/new failed: java.lang.reflect.InvocationTargetException target exception: 
<?xml version="1.0" encoding="UTF-8"?>

transform took 553 milliseconds
XSLProcessor: done
malta:~/tmp> 

THX,
Wolfgang

-- -----------------------------------------------------------------
Wolfgang May             E-mail: may@xxxxxxxxxxxxxxxxxxxxxxxxxx   
Universitaet Freiburg    http://www.informatik.uni-freiburg.de/~may/
Institut fuer Informatik D-79110 Freiburg / Germany
Lehrstuhl fuer Datenbanken und Informationssysteme
Tel ++49 761 203-8131    Fax ++49 761 203-8122 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.