Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 8th, 2011, 02:49 PM
Authorized User
 
Join Date: May 2007
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Default Converting or removing entities in conversion

I have the following input:

<title>Name, &lt;b&gt;Name&lt;/b&gt; &amp; Name&amp;#174;</title>

And need to output

<title><[CDATA[Name, Name & Name]]></title>

I have tried many different solutions and none work. Any suggestions out there? Thanks in advance!
 
Old March 8th, 2011, 08:18 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

In XSLT 2.0, use

Code:
replace(., '&lt;.*?&gt;', '')
For the CDATA, if you really need it, use

Code:
<xsl:output cdata-section-elements="title"/>
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
resolving entities stolte XSLT 5 February 24th, 2011 01:31 PM
Convert entities... carlosaml XSLT 12 October 17th, 2007 03:52 AM
referenced entities bcogney XML 7 April 21st, 2006 11:04 AM
referenced entities bcogney XSLT 0 April 20th, 2006 02:37 PM
Entities safin XSLT 1 November 7th, 2005 04:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.