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 17th, 2006, 09:51 PM
Authorized User
 
Join Date: Jun 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Comparing siblings

Hi there,

Is this possible to achieve usign XSLT?

This is my source XML

<RootNode>
    <Supplementary>
        <ValueItem>
            <RelatedEntityRef RelatedID="V1"/>
            <PercentOwned>
                <RelatedEntityRef RelatedID="Party-Person-1" ChangeOfNameRequired="No" Payment="200"/>
            </PercentOwned>
            <Asset>Car</Asset>
        </ValueItem>
        <ValueItem>
            <RelatedEntityRef RelatedID="V2"/>
            <PercentOwned>
                <RelatedEntityRef RelatedID="Party-Person-2" ChangeOfNameRequired="No" Payment="100"/>
            </PercentOwned>
            <PercentOwned>
                <RelatedEntityRef RelatedID="Party-Person-2" ChangeOfNameRequired="No" Payment="300"/>
            </PercentOwned>
            <Asset>Piano</Asset>
        </ValueItem>
    </Supplementary>
    <Main>
        <ValueItem>
            <Identifier UniqueID="V1"/>
            <PercentOwned>
                <RelatedEntityRef RelatedID="Party-Person-1"/>
            </PercentOwned>
        </ValueItem>
        <ValueItem>
            <Identifier UniqueID="V2"/>
            <PercentOwned>
                <RelatedEntityRef RelatedID="Party-Person-2" SecondHand="Yes"/>
            </PercentOwned>
            <PercentOwned>
                <RelatedEntityRef RelatedID="Party-Person-2" SecondHand="Yes"/>
            </PercentOwned>
        </ValueItem>
    </Main>
</RootNode>


and to be transformed into

<RootNode>
    <Main>
        <ValueItem>
            <Identifier UniqueID="V1"/>
            <PercentOwned>
                <RelatedEntityRef RelatedID="Party-Person-1" SecondHand="Yes" ChangeOfNameRequired="No">
                    <Payment>200</Payment>
                </RelatedEntityRef>
            </PercentOwned>
            <Asset>Piano</Asset>
        </ValueItem>
        <ValueItem>
            <Identifier UniqueID="V2"/>
            <PercentOwned>
                <RelatedEntityRef RelatedID="Party-Person-2" SecondHand="Yes" ChangeOfNameRequired="No">
                    <Payment>100</Payment>
                    <Payment>300</Payment>
                </RelatedEntityRef>
            </PercentOwned>
        </ValueItem>
    </Main>
</RootNode>


Thanks

 
Old June 17th, 2006, 09:56 PM
Authorized User
 
Join Date: Jun 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi again,

Just to add a bit of background. Basically, I am trying to merge stuff from the supplementary node to the main node. And then converting the Payment attribure into an element as I dont wish to repeat the \\PercentOwned\RelatedEntityRef element as the other attributes within the RelatedEntityRef element as exactly the same.

thanks again.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Introducing parent node to specific siblings Frimann XSLT 11 July 3rd, 2008 03:20 PM
first element in array nesting siblings rjonk XSLT 1 May 18th, 2008 03:53 PM
Problem accessing the following siblings. Tre XSLT 6 June 5th, 2007 11:13 AM
Turning Siblings into Children wolfie78uk XSLT 3 December 22nd, 2005 08:33 AM
Accessing Attributes of Siblings AForgue XSLT 2 November 4th, 2003 01:39 PM





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