[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: This could be simple, but not for me!

Subject: RE: This could be simple, but not for me!
From: "Kenny Akridge" <kenny@xxxxxxxxxxxxxxxxx>
Date: Tue, 25 May 2004 08:44:46 -0400
akridge
The best way to approach this is to find out what you need to do logically.
Based on your output, this is my though:

Match every unique occurrence of Root/Community/A/B/Info/Detail/@no (use a
template of a for-each)
	Concat the value of @no, Detail.
	Loop through all the matches of Detail and Detail/@no (most likely
using a key, but you could use other means)
		Print the ancestor::City and the preceding-sibling::Name

Of course, you didn't provide an actual spec, and this could be completely
wrong given your rules.  This ought to help you approach it though.  With
most programming, it is usually just a logical decomposition into functions.


-----Original Message-----
From: Kenny Bogoe (BogoeMD) [mailto:kenny@xxxxxxxxx] 
Sent: Tuesday, May 25, 2004 7:15 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  This could be simple, but not for me!

Hi,

Though I have been working sometime with XSLT, I am having trouble with this
transformation. Anyone know how to do this? The XML source is from a
database and is really really huge in size, so performance of the
transformation is very critical...


<Root>
    <Community>
        <City>City1</City>
        <A>
            <B>
                <Name>Name1</Name>
                <Info>
                    <Detail no="100">Red</Detail>
                </Info>
            </B>
            <B>
                <Name>Name2</Name>
                <Info>
                    <Detail no="200">Blue</Detail>
                </Info>
            </B>
            <B>
                <Name>Name3</Name>
                <Info>
                    <Detail no="300">Green</Detail>
                </Info>
            </B>
        </A>
    </Community>
    <Community>
        <City>City2</City>
        <A>
            <B>
                <Name>Name4</Name>
                <Info>
                    <Detail no="100">Red</Detail>
                </Info>
            </B>
            <B>
                <Name>Name5</Name>
                <Info>
                    <Detail no="200">Blue</Detail>
                </Info>
            </B>
            <B>
                <Name>Name6</Name>
                <Info>
                    <Detail no="400">Yellow</Detail>
                </Info>
            </B>
        </A>
    </Community>
</Root>


This is the result I need to produce:


100, Red

    City1
        Name1
    
    City2
        Name4
    
    
200, Blue

    City1
        Name2
        
    City2
        Name5
        
300, Green

    City1
        Name3
        
400, Yellow

    City2
        Name6

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.