Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old November 28th, 2006, 05:18 PM
Registered User
 
Join Date: Nov 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSL to replace text in XML file

Hi,
     I need to create an XSL to take an input XML and modify the contents of a particular tag. So the output XML is almsot same as the input XML except for the contents of a single element.For example, I wanty to change the contents of child2 only. rest of the document remains the same.
example: input.xml
Code:
<root>
    <parent>
        <child1>a</child1>
        <child2>b</child2>
    </parent>
    <parent>
    .
    .
    </parent>
</root>


My actual document is huge. I was lookign at the option of using apply-templates. Is it possible to do something like apply a template to just change the contents of child2 and apply another template to copy the remaining document as it is? Guide me please.
thanks,


  #2 (permalink)  
Old November 29th, 2006, 05:20 AM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ramesh.kumarm
Default

Hi,
I think you can do the other way round.
Copy all the contents and try to replace the child2 contents.
Check out this in http://p2p.wrox.com/topic.asp?TOPIC_ID=52685

Ramesh
"Always Look For Something NEW"


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search and Replace a text in XML file AyatKh XML 17 May 23rd, 2012 09:05 PM
How to pass the dynamic XML file name to XSL jle XSLT 3 March 13th, 2008 04:20 PM
HELP - Find text / Replace with email link (XML or peakfx XML 1 July 13th, 2007 09:07 PM
Word wrap in XSL that transforms to a text file suri_1811 XSLT 1 November 15th, 2006 03:59 PM
How to replace elements(from existed XML file)? hbcontract XML 1 October 30th, 2003 05:49 AM





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