After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 128460 - "-o" not creates output file if empty
"-o" not creates output file if empty
Status: VERIFIED WONTFIX
Product: libxslt
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2003-12-03 18:27 UTC by Oleg Paraschenko
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Oleg Paraschenko 2003-12-03 18:27:49 UTC
"xsltproc -o" saves result to a given file. If result of transformation is
empty, then file is not created.

But if output method is "text" and if there are no errors, then empty file
should be created.

Sample files:

----- <imglist.xsl>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
="1.0">
<xsl:output method="text"/>
	
<xsl:template match="*[@fileref]">
  <xsl:value-of select="concat(@fileref,'&#xa;')"/>
</xsl:template>

<xsl:template match="text()" />

</xsl:stylesheet>
----- </imglist.xsl>

----- <test1.xml>
<article>
  <graphic fileref="images/img1.png" />
  <graphic fileref="images/img2.png" />
</article>
----- </test1.xml>

----- <test2.xml>
<article>
  <para>no images</para>
  <para>no images</para>
</article>
----- </test2.xml>

When I run
$ ~/p/libxml/bin/xsltproc -o list1 imglist.xsl test1.xml
I get file "list1". All is ok.

But when I run
$ ~/p/libxml/bin/xsltproc -o list2 imglist.xsl test2.xml
I expect to get empty file "list2", but there are no file at all.
Comment 1 Daniel Veillard 2003-12-10 14:13:32 UTC
Hum ... I'm not sure I want to do this. For example people
using DocBook chunking may use a -o dir/filename option
where dir/filename is never created but used as the base
for the creation of the filenames of the actually generated
files.
Changing to create the resource if there is no output is a
significant change, I agree this might be surprizing initially
but that can be controlled from the stylesheet by simply outputting
something like a single line feed for example.
So I'm not tempted to change the behaviour of libxslt at this point.

Daniel
Comment 2 Oleg Paraschenko 2003-12-10 19:13:10 UTC
Simpler workaround is to use shell redirection ">".

As proper fix is a significant change, it is better to work on XML
functionality, not on minor problems. Closing.