This example only works with XSLTC. Please use a command like the following to run the transformation: > java org.apache.xalan.xslt.Process -in test.xml -xsl test.xsl -xsltc
If you want to use the redirect extension with Xalan, please use the following example: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:redirect="http://xml.apache.org/xalan/redirect" extension-element-prefixes="redirect" version="1.0"> <xsl:template match="/"> <xsl:text>This goes to standard output</xsl:text> <redirect:write file="blob.xml"> <xsl:text>This is written to the file 'blob.xml'</xsl:text> </redirect:write> </xsl:template> </xsl:stylesheet> For a detailed description on the redirect extension for Xalan, please see http://xml.apache.org/xalan-j/extensionslib.html#redirect. Morris Kwan XSLT Development IBM Toronto Lab Tel: (905)413-3729 Email: [EMAIL PROTECTED] Philip Crotwell <[EMAIL PROTECTED] To: [EMAIL PROTECTED] .edu> cc: Subject: xsltc:output and redirect example 11/11/2002 05:11 PM Hi The example on the xalan-j web page, http://xml.apache.org/xalan-j/extensions_xsltc.html#redirect_ext looke like this: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsltc="http://xml.apache.org/xalan/xsltc" xmlns:redirect="http://xml.apache.org/xalan/redirect" xsl:version="1.0"> <xsl:template match="/"> <xsl:text>This goes to standard output</xsl:text> <xsltc:output file="blob.xml"> <xsl:text>This ends up in the file 'blob.xml'</xsl:text> </xsltc:output> <redirect:write file="blob.xml" append="true"> <xsl:text>This is appended to the file 'blob.xml'</xsl:text> </redirect:write> </xsl:template> </xsl:stylesheet> But trying to run it with xalan-j 2.4.1, I get this: file:///Users/crotwell/Developement/sod/xml/redirectTest.xsl; Line 5; Column 22; XSLT Error (javax.xml.transform.TransformerConfigurationException): javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: "xsl:version" attribute is not allowed on the xsl:stylesheet element! Deleteing the xsl:version line gives this: file:///Users/crotwell/Developement/sod/xml/redirectTest.xsl; Line 5; Column 5; XSLT Error (javax.xml.transform.TransformerConfigurationException): javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: xsl:stylesheet requires attribute: version Apperently it is required, but not allowed! :) I figured out that it really wants just version="1.0" instead of xsl:version. Maybe that sould be fixed in the example. But, even that does not work. Running xalan2.4.1 on this, I don't get a blob.xml file. Instead I get this as the output, notice that the <xsltc:output and <redirect commands are just copied verbatum to the output. <?xml version="1.0" encoding="UTF-8"?> This goes to standard output<xsltc:output xmlns:redirect="http://xml.apache.org/ xalan/redirect" xmlns:xsltc="http://xml.apache.org/xalan/xsltc" file="blob.xml"> This ends up in the file 'blob.xml'</xsltc:output><redirect:write xmlns:redirect ="http://xml.apache.org/xalan/redirect" xmlns:xsltc="http://xml.apache.org/xalan /xsltc" append="true" file="blob.xml">This is appended to the file 'blob.xml'</r edirect:write> Can someone give me a working xsltc:output example? thanks, Philip
