Strip specific html tag in xslt
Hi,
Is there a way to strip specific html tag using xslt and still keep html content?
I.E. <p><a href="http://www.google.com">Google</a></p>
to
<p>Google</p>
Comments are currently closed for this discussion. You can start a new one.
2 Posted by Kris on 08 Dec, 2010 03:16 PM
I would try something like this. This is some code used to remove all HTML tags that I modified to remove only the tag specified in the parameter from the html passed into it. This is untested but should at least get you started. You will need to call this twice, once passing "a" as the tag and again with "/a" as the tag to remove the start and end tags so there may be a better way to do this in one call to the template.
Hope that helps get you on the path.
Kris
3 Posted by csaladores on 08 Dec, 2010 03:23 PM
Thanks Kris for the reply. It's definitely a good start.
Also using xsl:value-of removes all tags.
I have to modify value-of to copy-of to preserve the html.
I'll keep chugging along. I just need to remove <a> tag.
4 Posted by Ross on 04 Mar, 2011 09:06 PM
Christian, do you still need help with this?
Tim closed this discussion on 21 Jun, 2011 03:35 PM.