• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
sam joe
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry the graemlins ruined the XML. try to repost the XMLs.

 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
sam joe
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right. After I changed the XSL to



It works. Thanks a lot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic