[Libosinfo] [osinfo-db] install-script, opensuse: Add omit-xml-declaration to the output format
Daniel P. Berrange
berrange at redhat.com
Fri Apr 21 09:16:22 UTC 2017
On Fri, Apr 21, 2017 at 11:06:42AM +0200, Fabiano Fidêncio wrote:
> On Fri, Apr 21, 2017 at 10:45 AM, Daniel P. Berrange
> <berrange at redhat.com> wrote:
> > On Fri, Apr 21, 2017 at 10:37:37AM +0200, Fabiano Fidêncio wrote:
> >> Without this change the output got from the command-line template will
> >> look like "<?xml version=1> autoyast=device://sda/autoinst.xml" while
> >> what we actually expect is just "autoyast=device://sda/autoinst.xml".
> >
> > This description looks a bit odd - if I run
> >
> > $ osinfo-install-script -p jeos opensuse42.2
> >
> > it generates autoinst.xml, which contains
> >
> > <?xml version="1.0"?>
> > <profile xmlns:config="http://www.suse.com/1.0/configns" xmlns="http://www.suse.com/1.0/yast2ns">
> > <bootloader>
> > <device_map config:type="list">
> > ....snip....
> >
> > where is this
> >
> > "<?xml version=1> autoyast=device://sda/autoinst.xm"
> >
> > data that you're referring to ?
>
> You'll get it once you call
> osinfo_install_script_generate_command_line_for_media().
> The returned result depends on the output type set in for the XML file.
>
> So, instead of getting the expected
> "autoyast=device://sda/autoinst.xml" you'll get "<?xml version=1>
> autoyast=device://sda/autoinst.xml".
>
> We never been hit by this because all the other install-scripts we
> have are not XML files, but pure text files, while the openSUSE/SLES
> one is actually a XML.
Urgh, this approach to generating multiple different documents from
the single xsl template is broken by design :-(
You're lucky that omit-xml-declaration works here - the XSL code is
still generating what it thinks is XML here - it just happens you're
ok since you've only needed to generate a single line.
This should have been done by having separate <template> elements,
so we could then have <xsl:output method="xml"/> and
<xsl:output method="text"/> for the respective documents.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
More information about the Libosinfo
mailing list