• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry the graemlins ruined the XML. try to repost the XMLs.

 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are right. After I changed the XSL to



It works. Thanks a lot.
 
reply
    Bookmark Topic Watch Topic
  • New Topic