This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes why no matches past the Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "why no matches past the "/" and no output?" Watch "why no matches past the "/" and no output?" New topic
Author

why no matches past the "/" and no output?

Thomas Kennedy
Ranch Hand

Joined: Jan 20, 2008
Posts: 137
Given



and content.xsl:



It gets as far as the "/" template in content.xsl line 7 but it goes no further. In other words the <apply-templates> on line 8 finds no matches, and I get no output. Is it some namespace problem? Thank you.


Costs matter. Justice lies in processes not outcomes. Crime is caused by criminals.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Thomas Kennedy wrote:Is it some namespace problem?


Yes. Your "data" element name is in the default namespace, in other words in the "http://www.hp.com/dexix/content" namespace. But your stylesheet looks for "data" elements in no namespace, so it doesn't find any.

To fix that, change your stylesheet to declare the "http://www.hp.com/dexix/content" namespace and assign a prefix to it (i.e. don't make it the default namespace). You can use any prefix you like. Then change your stylesheet to search for "data" elements with that prefix, in otherwords to search for "data" elements in the "http://www.hp.com/dexix/content" namespace.
Thomas Kennedy
Ranch Hand

Joined: Jan 20, 2008
Posts: 137
That worked, thank you! Namespaces are slowly coming into focus.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: why no matches past the "/" and no output?
 
Similar Threads
XSL
XSLT value-of parameter not works as xml value
Creating a chart using xslt
to EXACT Dublicate an xml file[xml->xml] via Java TransformerFactory classes and XSTL well I do not
Problem with XSL.