File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes XSL fails with xmlns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSL fails with xmlns" Watch "XSL fails with xmlns" New topic

XSL fails with xmlns

lok bharatendu

Joined: Nov 21, 2008
Posts: 2
I am working on a webproxy portlet which fetches the contents of a web page and displays it in a portlet.
while doing so this portlet creates proxy of all the links. This is done with the help of an XSL.

Here is the XSL contents:

My problem is that if the page that is being accessed using this portlet contains html tag with xmlns then it does not get properly parsed
but if it just has <html> tag then it works properly.

Here is the example:
HTML Source:

Since the source has HTML with xmlns <HTML xmlns="">

The output to the portlet remains same as the original html (which is wrong).
If the source htlm doesn't have xmlns then following is the output for the portlet. (This is desired)

Please suggest me what needs to be changed in XSL to fix this problem.

Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

lok bharatendu wrote:
Here is the XSL contents:

HTML source:

You should qualify the xsl template to use the namespace:

If you want the template to match against a HTML element which doesn't have a namespace then you could add a "|" (or) condition:

Try it yourself here

[My Blog] [JavaRanch Journal]
I agree. Here's the link:
subject: XSL fails with xmlns
It's not a secret anymore!