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

XSLT Difference between xalan-j & new Xalan-Java2

Subject: XSLT Difference between xalan-j & new Xalan-Java2
From: "Albert Tsun" <albert.tsun@xxxxxxxxxxxx>
Date: Wed, 14 Feb 2001 17:55:59 +0800
redirect write xslt

Hi All,

I have downloaded the new Xalan-Java2, there is some difference from the
one I used.

(1)  In my old 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 file="{$outputpath}/{$file}">
        <xsl:call-template name="print-header"/>
    </redirect:write>
</xsl:template>

I works fine for xalan-j.

However, when I use the new API provided by Xalan-Java2, when I try to pass
"file:/d:/SETProject/output/" as outputpath parameter into the stylesheet,
the xalan XSLT transformer make the string value I passed to XSL becomes
quoted with "'" which makes the file path construction logic making an
invalid file path.

(2) Besides, in my previously worked XSL, I usually put below section at
the begining of each file

<!DOCTYPE xsl:stylesheet [
<!ENTITY nl "<xsl:text>&#xA;</xsl:text>">
<!ENTITY nbsp "<xsl:text>&#x20;</xsl:text>">
]>

and I use
     &nl;
     &nbsp;
in somewhere inside the XSL.

However, when I use transform
        transformer = tFactory.newTransformer(new StreamSource(xslfile));

The parser seems to treat it as invalid syntax and shows error. However, it
 was OK when I use xalan-j.

Is there any ways I can solve it if I want to use the new Xalan-Java2 API ?

Thanks in advance.






"Jarno Elovirta" <jarno@xxxxxxxxxxxx> on 29/11/2000 01:47:00 PM

To:   Albert Tsun/Excel
cc:

Subject:  RE: URL stroke passing in XSL




Hip hei!

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

Instead use

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

I think that should work, since the select attribute interprets it's value
as an XPath expression. But then again it's 7:47 AM here, so I might be
wrong ;)

Jarno Elovirta






 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.