XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Tom PhetheanSubject: 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.

Thanks in advance.
Tom

Postnext
(Deleted User) Subject: Remove HTML elements from string
Author: (Deleted User)
Date: 05 May 2005 11:58 AM
inside <element>, other then those html elements, do you have other type of elements?

Postnext
Tom PhetheanSubject: Remove HTML elements from string
Author: Tom Phethean
Date: 06 May 2005 05:12 AM
Thanks for your reply,

The only elements I allow to appear within the <element> tags are <b></b> and <i></i>.

HTML entities are allowed, but that shouldnt have any bearing on this problem.

Posttop
(Deleted User) 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.

Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.