RE: [xsl] no output files

Subject: RE: [xsl] no output files
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 19 Nov 2008 14:46:01 -0000
> Another way to do the same, without worrying about 
> implementation specifics is to enclose the transformation 
> into an <xsl:variable/> (which means that nothing is to be 
> done with this variable).
> 
> As this variable will capture the results of the 
> transformation, no output will be produced.

Not so. The transformation

<xsl:template match="/">
  <xsl:variable name="x" select="2"/>
</xsl:template>

produces as its output a result tree consisting of a document node with no
children. If the transformation output is serialized and directed to a file
out.xml, the effect should be that after the transformation, out.xml exists
and contains only an XML declaration (regardless of whether or not the file
existed previously).

You can of course, as others have suggested, send the output to somewhere
where it does no harm. I was trying to answer the question more literally -
how do you arrange to produce no output in the first place.

Michael Kay
http://www.saxonica.com/

Current Thread