You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Scott Boag/CAM/Lotus <Sc...@lotus.com> on 2000/11/29 19:17:17 UTC

Re: Xalan : setStylesheetParam queries

> <redirect:write select="{$outputpath}/{$file}">

I don't really understand the select attribute value here.  This is going
to expand to something like "file:/d:/SETProject/output/foo.xml".  The
redirect lib is taking this as a select statement, not a file name, and
thus it thinks the "file:" is a prefix.  Don't you want <redirect:write
file="{$outputpath}/{$file}">?

-scott




                                                                                                                      
                    "Albert Tsun"                                                                                     
                    <albert.tsun@exc        To:     scott_boag@lotus.com                                              
                    el.com.hk>              cc:                                                                       
                                            Subject:     Xalan : setStylesheetParam queries                           
                    11/28/2000 09:35                                                                                  
                    PM                                                                                                
                                                                                                                      
                                                                                                                      






Hi Scott,

Sorry to email you directly, since the list is getting very slow these days
and you are very kind to setStylesheetParam question, so I mail to you.

I am now trying to pass a URL as a parameter into a stylesheet  in order to
get multiple output files in
a specific output directory. I am using xalan-J for my XSLT.

in my Java program:

processor.setStylesheetParam("outputpath", "'file:\\d:\\output'");
processor.setStylesheetParam("gendate", "'20001129'");

stylesheet :

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

<xsl:param name="outputpath"
select="'file:\d:\setproject\settlement\output'"/>
<xsl:param name="gendate" select="'20001231'"/>

<xsl:template match="SetReport2:Header">
    <xsl:variable name="file" select="concat('header_',$gendate,'.xml')"/>
    <redirect:write select="{$outputpath}/{$file}">
        <xsl:call-template name="print-header"/>
    </redirect:write>
</xsl:template>

but when I try to pass "file:/d:/SETProject/output/" as outputpath
parameter into the stylesheet,
the xalan XSLT transformer prompt me with errors.

XSLT Error :

Call to extension function failed: method call/new failed:
java.lang.reflect.InvocationTargetException target exception:
java.lang.RuntimeException: ElemTemplateElement error: Can not resolve
namespace prefix: file

(This seems that the colon ":" is taken as a namespace)

Would some please kindly give me some hint how to solve it.

Many Thanks in advance.