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 January 13th, 2011, 05:57 PM
Registered User
 
Join Date: Jan 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to insert string to cdata section after a specific string?

Code:
<text><![CDATA[<span class="tag">hello</span>]]></text>
In the code above, how can I insert
Code:
style="float:right;"
after class="tag" in xsl stylesheet.


Thank you in advance.
 
Old January 14th, 2011, 05:25 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

As the span element is inside the CDATA element then it is just text as far as the XSLT processor is concerned, so you just have to treat it like a string.

You could use substring-after() and substring-before(), perhaps, splitting on the '>' character. Alternatively you could use substring() and be specific about the position of the strings to extract.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old January 14th, 2011, 10:44 AM
Registered User
 
Join Date: Jan 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you so much for the reply!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Get a specific text from a string mrame XSLT 3 April 7th, 2009 07:03 AM
Is CDATA same as xsd:String rajat_aggarwal03 XML 2 October 24th, 2008 01:05 PM
Add a CDATA section; add nodeset to CDATA section kssudhish XSLT 3 January 3rd, 2008 07:13 AM
Finding specific string martinrhague Access 7 November 2nd, 2006 12:54 PM
How to retrieve specific string zorzos Excel VBA 1 August 25th, 2004 05:41 AM





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