This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes XML and Related Technologies and the fly likes Removing a href tags using XSL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Removing a href tags using XSL" Watch "Removing a href tags using XSL" New topic
Author

Removing a href tags using XSL

Vineet Solabannavar
Greenhorn

Joined: Aug 27, 2005
Posts: 14
Hi,

I have an XML with HTML tags.
I want to remove the <a href> tags and keep the remaining XML as it is using XSL transformation.

How can I do it using xsl:copy-of?


The above code is the input xml.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Okay, now that you know how to use an identity transformation, add to that a template that matches "a" and produces no output.
Vineet Solabannavar
Greenhorn

Joined: Aug 27, 2005
Posts: 14
Hi,

Thanks for the suggestion.
I have one more problem, I want to just match the img tags in the XML and copy all the remaining HTML tags as they are to the output.

Please suggest a solution.

Thanks in advance

Vineet
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

That's the same problem, just with "a" replaced by "img".

Use an identity transformation plus a template that matches your <img> elements and does whatever you want to do with them.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Removing a href tags using XSL