XSLT <namespace-alias> element not support

Assigned to



15 years ago
7 years ago


(Reporter: Ian Graham, Assigned: peterv)



Firefox Tracking Flags

(Not tracked)



(1 attachment)



15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624
Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624

As noted, the indicated XSLT element is not supported. Testcase (to be attached
also is as follows:

Load into Mozilla the following XML data file (data-5.xml):

<?xml version="1.0" ?>
<?xml-stylesheet href="transform-5.xsl" type="text/xsl"  ?>
<pa:data xmlns:pa="http://www.dummy.com/spaceA"
          xmlns:pb="http://www.dummy.com/spaceB" >
     raw data in data element
      <pa:item  att1="foo"  pa:att1="goo" pb:att2="boo"> item in spaceA element
     <pb:item> item in spaceB element</pb:item>

This will then load in the stylesheet transform-5.xsl

<xsl:stylesheet version="1.0" 
   xmlns:xslout="http://dummy.org" >
  <xsl:namespace-alias stylesheet-prefix="xslout" result-prefix="xsl"  />
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
     <xslout:stylesheet version="1.0" >
        <xslout:output method="xml" indent="no" />

The result should be something like:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no" />

But Mozilla produces:

<xslout:stylesheet xmlns:xslout="http://dummy.org" version="1.0"><xslout:output
method="xml" indent="no"/>

-- the output namespace is wrong. 

This fails on Mozilla 1.4 (release) and on latest Firebird build (Mozilla/5.0
(Windows; U; Win98; en-US; rv:1.5a) Gecko/20030725 Mozilla Firebird/0.6) 

Reproducible: Always

Steps to Reproduce:
1. see above.

Expected Results:  
SHould implement <namespace-alias> element.

Comment 1

15 years ago
Created attachment 128592 [details]
zipped up testcase (as per description)

Comment 2

14 years ago
I'm tempted to do this, but let's clear this out a bit first.

namespace-alias only works on literal results, but not on xsl:element or
xsl:attribute, right? As those don't create literal namespace URIs. Or am I
reading this too strict?
Summary: XSLT <namespace-alias> element not support → XSLT <namespace-alias> element not support

Comment 3

14 years ago
Not quite sure what you mean.  My guess has been that namespace-alias remapping
would be applied after the transformation is complete, and that the application
simply remaps the 'dummy' namespace (the one that's being aliased as
stylesheet-prefix) to the desired target namespace.  So, yes, in that sense it
only applies to the literal results. 

However, the details of this (7.7.1 in the spec) are, to my little mind, rather
hard to follow .... particularly for cases where there may be multiple aliasing
elemetns in the stylesheet ..
Pike: Yes, i read the spec the same way as you.

Ian: doing some sort of post-processing on the result document would be
hellishly hard, and is not how i read the spec.

We could implement it as some sort of post-processing on the compiled stylesheet
though... But i'm leaving that up to pike

Comment 5

14 years ago
The xalan tests are with me as well, namespace24 checks exactly that.

I'm afraid that I will need to do post-processing of the txStartLREElement and
txAttribute instructions on the merging of the stylesheets, as namespace aliasing
is not known during the compilation of the templates. I could extend the
evaluation context and whack the instructions to check on eval, but that seems to
be putting cost on this rarely used feature for everybody. And now I'm going
to add inspection code to instructions, bah on me.

Comment 6

10 years ago
Is there a way to add the support for the <namespace-alias> element ?
It is used to generate XSL from a xml/xsl transformation. There are no other way to generate xsl.

Ignore the element using the alias namespace, just add it to the output and replace the prefix with the one specified in the <namespace-alias> attribute.

I m afraid that now many people are using those sort of transformations and it's fully part of the xslt 1.0 recommendations as a high level item.


10 years ago
Duplicate of this bug: 419022

Comment 8

10 years ago
In cases of small stylesheets the XSL generation problem can be solved using xsl:element / xsl:attribute for elements in xsl namespace but it's very awkward IMO. Another workaround is some ugly postprocessing. Please add xsl:namespace-alias...
QA Contact: keith → xslt
You need to log in before you can comment on or make changes to this bug.