Subject:Remove HTML elements from string Author:Tom Phethean Date:05 May 2005 05:11 AM
Hi,
I'm trying to remove all the HTML elements from a string using XSL, I have an XML document of the format:
<element>My <b>Formatted</b> Title</element>
This then needs to be displayed in two places, firstly as headline for an article (where the formatting is used), and secondly in the <title> element in the head of the page. Of course the title element cannot handle the <b> tags and so displays them in the title bar.
Is there any way of telling XSLT (or HTML for that matter) to ignore the elements, or remove them from the string, when I display them in the title? I have experiemented with substringing, but can't get it to work recursively for multiple elements/element types.
Subject:Remove HTML elements from string Author:(Deleted User) Date:09 May 2005 05:50 AM
Hi Tom,
if you need to extract just the raw text inside the <element> tag (in order to have a proper title for the page) you can use xsl:value-of; when applied to an element it will return all the text fragments that are children of that element and (recursively) of all its children elements.