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 June 6th, 2012, 04:27 PM
Authorized User
 
Join Date: Jun 2012
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default merging and restructing nodes content of same type

<xml>
<head>
<info>
<content>

<source attribute1="RSC1985s5c1" attribute2="6(17)">
data1
</source>
<cite/>
<case/>
<target attribute1="LRC1985s5c1" attribute1="6(17)1">
3e/191
</target>
</content>

<content>

<source attribute1="RSC1985s5c1" attribute2="6(17)">
data2
</source>
<cite/>
<case/>
<target attribute1="LRC1985s5c4" attribute2="6(17)1">
4e/54
</target>
</content>
</info>
</head>
</xml>

What i want is to merge the content of nodes in to single node, output should be like

<xml>
<head>
<info>
<content>
<source attribute1="RSC1985s5c1" attribute2="6(17)">
data1
</source><source attribute1="RSC1985s5c1" attribute2="6(17)">
data2
</source>
<cite/>
<case/>
<target attribute1="LRC1985s5c1" attribute1="6(17)1">
3e/191
</target>
<source attribute1="RSC1985s5c1" attribute2="6(17)">
data2
</source>
<cite/>
<case/>
<target attribute1="LRC1985s5c4" attribute2="6(17)1">
4e/54
</target>
</content>
</info>
</head>
</xml>
 
Old June 6th, 2012, 06:39 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This question is structurally identical to the question you submitted at need to add adjacent element(with their child nodes) in to single in XSLT

And it begs all the same questions. It looks like a completely trivial transformation, so it's not clear why you are asking the question: have you done any kind of reading to learn about how this language works? It's also far from clear what the general requirement is - people don't usually write a stylesheet to transform one input document, they do it to apply similar transformations to a whole class of input documents, and it's hard to work out from your one example what the general problem might be. In the other thread Martin asked all these questions, and you haven't really answered them.
__________________
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
Merging nodes trishla XSLT 11 October 18th, 2007 03:01 PM
Grabbing content from 2 XML files and merging yanzickp XSLT 4 August 6th, 2007 10:07 AM
Content-type = text/html tarran C# 3 December 5th, 2004 08:36 AM





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