You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Frank Chen <fr...@ms5.hinet.net> on 2001/05/19 05:17:24 UTC

A Suspectable Bug:xsl:namespace-alias

Hi:

Xalan-J 2.0.0 xsl:namespace-alias element cannot work correctly:

Try this:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias"
                version="1.0"
>

<xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>

<xsl:template match="/">
  <axsl:stylesheet version="1.0">
    <axsl:output method="html"/>
  </axsl:stylesheet>
</xsl:template>

</xsl:stylesheet>

After transforming, it outputs:

<?xml version="1.0" encoding="UTF-8"?>
<axsl:stylesheet xmlns:axsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><axsl:output method="html"/></axsl:stylesheet>

However, I think it should output this:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html" /></xsl:stylesheet>

Frank








Re: A Suspectable Bug:xsl:namespace-alias

Posted by Gary L Peskin <ga...@firstech.com>.
Frank --

This is not a bug.  In fact, both the output shown by Xalan below and
what you think the output should be, also shown below, are equivalent. 
This is because XML uses the actual namespace URI to determine the
namespace of a prefixed element or attribute.  The prefix that is used
is irrelavent.  It is the namespace URI that governs the namespace in
use.  In both examples, the namespace URI is the same.

Xalan is free to use whatever prefix it wants to assign to the namespace
URI.  It used axsl.  It could also have used xyz or frank, for that
matter.  In other words, this would also be equivalent XML:

  <?xml version="1.0" encoding="UTF-8"?>
  <frank:stylesheet version="1.0"
  xmlns:frank="http://www.w3.org/1999/XSL/Transform"><frank:output
  method="html" /></frank:stylesheet>

If you reread the XSLT spec on this
(http://www.w3.org/TR/xslt#literal-result-element), you'll see that it
speaks of aliases for the namespace URI and leaves the XSLT processor
free to use whatever prefix it wants.

Please reread the spec and then ask more questions if you have them.  It
is important for this to be clear to you.

Gary


> Frank Chen wrote:
> 
> Hi:
> 
> Xalan-J 2.0.0 xsl:namespace-alias element cannot work correctly:
> 
> Try this:
> 
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                 xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias"
>                 version="1.0"
> >
> 
> <xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>
> 
> <xsl:template match="/">
>   <axsl:stylesheet version="1.0">
>     <axsl:output method="html"/>
>   </axsl:stylesheet>
> </xsl:template>
> 
> </xsl:stylesheet>
> After transforming, it outputs:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <axsl:stylesheet xmlns:axsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0"><axsl:output method="html"/></axsl:stylesheet>
> 
> However, I think it should output this:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output
> method="html" /></xsl:stylesheet>