Meaningless Drivel is fun!*
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 Murach's Java Servlets and JSP this week in the Servlets 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
Author

Select specific tags in html using XSLT

sripadraj kudur
Greenhorn

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
Sripad
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Select specific tags in html using XSLT
 
Similar Threads
XSL
to EXACT Dublicate an xml file[xml->xml] via Java TransformerFactory classes and XSTL well I do not
XSLT problem.
Need help with XSLT, modifying XML config files.
Passing Files in Web Services