aspose file tools*
The moose likes XML and Related Technologies and the fly likes Why XSL failed to transform the XML when root node has namespace defined? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Why XSL failed to transform the XML when root node has namespace defined?" Watch "Why XSL failed to transform the XML when root node has namespace defined?" New topic
Author

Why XSL failed to transform the XML when root node has namespace defined?

sam joe
Greenhorn

Joined: Jul 23, 2003
Posts: 24
I have an XML and XSL. The XML has a root node called <deployment>, the XSL will pick only <service> node (deep copy) and output. The strange thing is that if <deployment> have attributes 'xmlns' and
'xmlns:java' defined, the XSL doesn't output anything. If I change the the <deployment> node in XML from

to

.

The XSL works perfect. Does anybody know why the namespace affect the XSL transformation? Thanks a million.

sam joe
Greenhorn

Joined: Jul 23, 2003
Posts: 24
Sorry the graemlins ruined the XML. try to repost the XMLs.

Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Since this post is related to XML, I am moving this to our XML and related technologies forum.
Please continue your discussion there.
Regards
Balaji


Spritle Software Blogs
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
You may want to read Ronald Bourret's XML namespaces FAQ.

<deployment> the element's name is "deployment"

<deployment
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

the element's name is "{http://xml.apache.org/axis/wsdd/}:deployment"; the "xmlns" declares the default namespace that the enclosing element belongs to (and any unprefixed element that it contains).

Your XSL matches the <deployment> and <service> it does not match
<{http://xml.apache.org/axis/wsdd/}:deployment>
or
<{http://xml.apache.org/axis/wsdd/}:service>
[ March 15, 2006: Message edited by: Peer Reynders ]

"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
sam joe
Greenhorn

Joined: Jul 23, 2003
Posts: 24
You are right. After I changed the XSL to



It works. Thanks a lot.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why XSL failed to transform the XML when root node has namespace defined?
 
Similar Threads
JSP as webservice client
Axis Complex Type
problem when trying to use return type Integer
Not able to redeploy my web service in eclipse
The AXIS engine could not find a target service to invoke