You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Robb Beal <ro...@usercreations.com> on 2003/08/07 01:17:09 UTC

Suppressing xmlns="" (Amazon Web Services)

Folks.

It appears that Amazon is using Xalan for XSL processing,

> Version number: 1
> Vendor: Apache Software Foundation
> Vendor URL: http://xml.apache.org/xalan-c

After transformation, we're seeing things like <Asin  
xmlns="">088730995X</Asin> when for example dereferencing,

> http://xml.amazon.com/onca/xml3?v=1.0&t=usercreations-20&dev- 
> t=D1HTPQET64F8JH&AsinSearch=088730995X&type=lite&f=http:// 
> www.usercreations.com/xsl/amazon_example1.xsl

Without the default namespace declaration on <foo>, the xmlns="" goes  
away,

> http://xml.amazon.com/onca/xml3?v=1.0&t=usercreations-20&dev- 
> t=D1HTPQET64F8JH&AsinSearch=088730995X&type=lite&f=http:// 
> www.usercreations.com/xsl/amazon_example2.xsl

The default namespace is necessary in our rich internet app and  
xmlns="" causes an exception. Is there a simple modification to the XSL  
that would solve the problem?

Thanks!

Robb Beal
UserCreations


Re: Suppressing xmlns="" (Amazon Web Services)

Posted by da...@us.ibm.com.



Hi Robb,

I'm afraid you're really not giving us enough information to go on here,
but I'll make some guesses.

The first thing is I'm not sure this is a Xalan-specific question, so this
is not the appropriate forum.  For generic XSLT questions, I would
recommend you subscribe and post to the Mulberry Technologies XSL list.

You need to understand how namespaces work to understand why Xalan is
generating a the namespace declaration that "undeclares" the default
namespace.  In a stylesheet, a literal result element, like the "foo"
element in your first stylesheet has an expanded name, which includes the
namespace URI.  When it is copied to the result tree, it keeps that
expanded name.  When you copy other elements, in this case, from the source
document, they also keep their expanded name.  If those elements have null
namespace URI, or a namespace URI that is different from the "foo" element,
and they have no prefix, the processor has to make sure those elements are
in the proper namespace when it serializes the result tree.

In this case, those elements have no namespace, so Xalan _must_ add the
namespace declaration that "undeclares" the default namespace.  If you
don't want this namespace declaration, then you must either copy the
elements from the source document and change their expanded names, or avoid
using the default namespace in your stylesheet.

Dave



                                                                                                                                  
                      Robb Beal                                                                                                   
                      <robb@usercreati         To:      xalan-c-users@xml.apache.org                                              
                      ons.com>                 cc:      (bcc: David N Bertoni/Cambridge/IBM)                                      
                                               Subject: Suppressing xmlns="" (Amazon Web Services)                                
                      08/06/2003 04:17                                                                                            
                      PM                                                                                                          
                                                                                                                                  



Folks.

It appears that Amazon is using Xalan for XSL processing,

> Version number: 1
> Vendor: Apache Software Foundation
> Vendor URL: http://xml.apache.org/xalan-c

After transformation, we're seeing things like <Asin
xmlns="">088730995X</Asin> when for example dereferencing,

> http://xml.amazon.com/onca/xml3?v=1.0&t=usercreations-20&dev-
> t=D1HTPQET64F8JH&AsinSearch=088730995X&type=lite&f=http://
> www.usercreations.com/xsl/amazon_example1.xsl

Without the default namespace declaration on <foo>, the xmlns="" goes
away,

> http://xml.amazon.com/onca/xml3?v=1.0&t=usercreations-20&dev-
> t=D1HTPQET64F8JH&AsinSearch=088730995X&type=lite&f=http://
> www.usercreations.com/xsl/amazon_example2.xsl

The default namespace is necessary in our rich internet app and
xmlns="" causes an exception. Is there a simple modification to the XSL
that would solve the problem?

Thanks!

Robb Beal
UserCreations