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 Select specific tags in html using XSLT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Select specific tags in html using XSLT" Watch "Select specific tags in html using XSLT" New topic

Select specific tags in html using XSLT

sripadraj kudur

Joined: Nov 10, 2011
Posts: 4
Hello all ,

I have been trying to parse the html and get/extract few tags from the html using xslt. My XSLT is as given below:

I need only few tags, like '<a>' and <img> in the above XSLT but the code outputs the entire html.
Can anybody point out what could have gone wrong. A sample code would be helpful.

Thank you
Paul Clapham

Joined: Oct 14, 2005
Posts: 19357

Well, yes, what you have there is basically the identity transformation, so naturally what you get as a result is basically the entire document. That's what the identity transformation does, it just copies the entire document.

So, if your desired output isn't a slightly-modified version of the entire document, then don't start with the identity transformation as the basis for your XSLT code.
Have you tried LearnNowOnline?
subject: Select specific tags in html using XSLT