Your message dated Sun, 2 Mar 2008 15:45:47 +0100
with message-id <[EMAIL PROTECTED]>
and subject line Re: [xml/sgml-pkgs] Bug#468871: The suggestion by the bug
closer doesn't work
has caused the Debian Bug report #468871,
regarding xsltproc: namespace-alias doesn't work
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [EMAIL PROTECTED]
immediately.)
--
468871: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468871
Debian Bug Tracking System
Contact [EMAIL PROTECTED] with problems
--- Begin Message ---
Package: xsltproc
Version: 1.1.22-1
Severity: normal
In order to produce a stylesheet from xml and a stylesheet one needs to use a
namespace prefix other than xsl:. This is typically turned into a useable
stylesheet by using namespace-alias, unfortunately it doesn't do anything with
xsltproc.
The following example produces the following error when trying to use the
result stylesheet on another xml file:
compilation error: file test.xsl line 2 element stylesheet
xsltParseStylesheetProcess : document is not a stylesheet
Replacing <gconf:stylesheet xmlns:gconf="..."> with <xsl:stylesheet
xmlns:gconf="..." xmlns:xsl="..."> (and corresponding closing tag), works.
An example stylesheet snippet:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:gconf="output.xsl" >
<xsl:namespace-alias stylesheet-prefix="gconf"
result-prefix="xsl" />
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<gconf:stylesheet xmlns:gconf="http://www.w3.org/1999/GCONF/Transform"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<gconf:output method="xml" />
<gconf:template match="/">
<xsl:apply-templates select="gconf" />
</gconf:template>
</gconf:stylesheet>
</xsl:template>
<xsl:template match="/gconf">
<gconf>
<xsl:apply-templates />
</gconf>
</xsl:template>
<xsl:template match="[EMAIL PROTECTED]">
<xsl:element name="gconf:choose">
<xsl:element name="gconf:when">
<xsl:attribute name="test">not(<xsl:value-of select="name(.)" />[EMAIL
PROTECTED]'<xsl:value-of select="@name" />'])</xsl:attribute>
<xsl:element name="{name(.)}">
<xsl:for-each select="@*">
<xsl:attribute name="{name(.)}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates />
</xsl:element>
<xsl:element name="gconf:otherwise">
With some XML:
<gconf>
<dir name="apps">
<dir name="panel">
<dir name="applets">
<dir name="system_monitor_screen0">
<dir name="prefs">
<entry name="view_diskload"
schema="/schemas/apps/multiload/prefs/view_diskload" type="bool" value="true">
</entry>
<entry name="view_cpuload"
schema="/schemas/apps/multiload/prefs/view_cpuload" type="bool" value="true">
</entry>
<entry name="view_netload"
schema="/schemas/apps/multiload/prefs/view_netload" type="bool" value="true">
</entry>
</dir>
</dir>
</dir>
</dir>
</dir>
</gconf>
And some of the output:
<?xml version="1.0"?>
<gconf:stylesheet xmlns:gconf="http://www.w3.org/1999/GCONF/Transform"
version="1.0">
<gconf:output method="xml"/>
<gconf:template match="/">
<gconf xmlns:gconf="http://www.w3.org/1999/XSL/Transform">
<gconf:choose xmlns:gconf="output.xsl"><gconf:when test="not([EMAIL
PROTECTED]'apps'])"><dir name="apps">
<gconf:choose><gconf:when test="not([EMAIL
PROTECTED]'panel'])"><dir name="panel">
<gconf:choose><gconf:when test="not([EMAIL
PROTECTED]'general'])"><dir name="general">
<gconf:choose><gconf:when test="not([EMAIL
PROTECTED]'applet_id_list'])"><entry name="applet_id_list" type="list"
ltype="string">
<li type="string">
<stringvalue>system_monitor_screen0</stringvalue>
</li>
<li type="string">
<stringvalue>drive_mounter_screen0</stringvalue>
The proper behaviour is defined in XSLT section 7.1.1
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.24-1-686 (SMP w/1 CPU core)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages xsltproc depends on:
ii libc6 2.7-6 GNU C Library: Shared libraries
ii libgcrypt11 1.4.0-3 LGPL Crypto library - runtime libr
ii libxml2 2.6.31.dfsg-1 GNOME XML library
ii libxslt1.1 1.1.22-1 XSLT processing library - runtime
xsltproc recommends no packages.
-- no debconf information
--- End Message ---
--- Begin Message ---
On Sun, Mar 02, 2008 at 09:34:23AM -0500, Daniel Dickinson wrote:
> Because the result xmlns:gconf= is
> http://www.w3.org/1999/GCONF/Transform
> AND xstlproc fails to work with an stylesheet prefix other than xsl:
>
> Also, please note that I submitted additional information after the bug
> was closed (before realizing it was closed), so you will not have
> received notification of it.
No, it works
[EMAIL PROTECTED]:/tmp$ cat foo.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:gconf="http://www.w3.org/1999/GCONF/Transform">
<xsl:namespace-alias stylesheet-prefix="gconf"
result-prefix="xsl" />
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<gconf:stylesheet version="1.0">
<gconf:output method="xml" indent="yes"/>
<gconf:template match="/">
<test/>
</gconf:template>
</gconf:stylesheet>
</xsl:template>
</xsl:stylesheet>
[EMAIL PROTECTED]:/tmp$ cat foo.xml
<gconf/>
[EMAIL PROTECTED]:/tmp$ xsltproc foo.xsl foo.xml
<?xml version="1.0"?>
<gconf:stylesheet xmlns:gconf="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<gconf:output method="xml" indent="yes"/>
<gconf:template match="/">
<test/>
</gconf:template>
</gconf:stylesheet>
[EMAIL PROTECTED]:/tmp$ xsltproc foo.xsl foo.xml > gconf.xsl
[EMAIL PROTECTED]:/tmp$ xsltproc gconf.xsl foo.xml
<?xml version="1.0"?>
<test/>
Mike
--- End Message ---