Your message dated Sun, 2 Mar 2008 11:23:19 +0100
with message-id <[EMAIL PROTECTED]>
and subject line Re: [xml/sgml-pkgs] Bug#468871: xsltproc: namespace-alias 
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 Sat, Mar 01, 2008 at 08:45:11PM -0500, Daniel Dickinson wrote:
> 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" >
                             ^^^^^^^^^^
Here, you should be using 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 xmlns:gconf="http://www.w3.org/1999/GCONF/Transform";
                        ^
You can just drop this declaration
>                     xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
And this one, too.
>                     version="1.0">

And then, it just works as the xslt spec expects it to work: you will end
up with
<gconf:stylesheet xmlns:gconf="http://www.w3.org/1999/XSL/Transform";>

which is well enough for it to be considered a stylesheet (and that is
also why if the gconf prefix is associated to
http://www.w3.org/1999/XSL/Transform, you get an error : it considers it
as part of the stylesheet.

See http://www.w3.org/TR/xslt#literal-result-element, it doesn't talk
about namespace-alias changing the prefix, but the namespace URI.

Mike


--- End Message ---

Reply via email to