aspose file tools*
The moose likes XML and Related Technologies and the fly likes XSLT:XML->XML:Auto-Add undesirable xmlns declaraction ..... please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSLT:XML->XML:Auto-Add undesirable xmlns declaraction ..... please help" Watch "XSLT:XML->XML:Auto-Add undesirable xmlns declaraction ..... please help" New topic
Author

XSLT:XML->XML:Auto-Add undesirable xmlns declaraction ..... please help

Yi Meng
Ranch Hand

Joined: May 07, 2003
Posts: 270
Hi,

I am trying to do an xml to xml transformation using xslt, my source xml is fully qualified while my desired result xml is not. The problem is as follows,

source xml


xslt



and result xml



what i really hate is the xmlns:a="http://some.namespace.com/" part in the result xml file... i don't want that....can anyone help???

Thank you very much.
[ November 07, 2006: Message edited by: Yi Meng ]

Meng Yi
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

This isn't actually a problem, you know. The namespace declaration may be taking up space, but it doesn't change the meaning of the XML document in any way.
Yi Meng
Ranch Hand

Joined: May 07, 2003
Posts: 270
Originally posted by Paul Clapham:
This isn't actually a problem, you know. The namespace declaration may be taking up space, but it doesn't change the meaning of the XML document in any way.


Thank you, I generally agree with you, but...

My client is using a dtd and it gives a complaint, sth like Attribute "xmlns:a" must be declared for element type "b"

I don't want to blame their dtd and instead i'd like to omit that xmlns declaraction if possible in xslt... otherwise, i will basically have to do a text edit...
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Ah, working around other people's buggy software (and identifying a namespace declaration as an attribute is definitely a bug). I took a quick look in the XSLT FAQ and found this in the "Namespaces" section:

http://www.dpawson.co.uk/xsl/sect2/N5536.html#d6682e1543
Yi Meng
Ranch Hand

Joined: May 07, 2003
Posts: 270
Originally posted by Paul Clapham:
Ah, working around other people's buggy software (and identifying a namespace declaration as an attribute is definitely a bug). I took a quick look in the XSLT FAQ and found this in the "Namespaces" section:

http://www.dpawson.co.uk/xsl/sect2/N5536.html#d6682e1543


Thank you very much, Paul. That is really useful...


The solution is to modify the xslt to....just for those concerned...

[ November 08, 2006: Message edited by: Yi Meng ]
 
jQuery in Action, 2nd edition
 
subject: XSLT:XML->XML:Auto-Add undesirable xmlns declaraction ..... please help