You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Philip Crotwell <cr...@seis.sc.edu> on 2002/11/11 23:11:35 UTC

xsltc:output and redirect example

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