XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 13th, 2003, 11:39 AM
neobuddah's Avatar
neobuddah neobuddah is offline
cosmos curator
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2002
Location: Leeds, UK
Posts: 678 neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level)neobuddah User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 14 h 17 m 49 sec
Reputation Power: 8
Question XSL: Grouping of child elements

Hi.

I have an XML file along the lines of the following construction:
Code:
<?xml version="1.0" ?>
<filesys>
    <folder name="folder 1" id="1">
        <file name="File1" id="1" />
        <folder name="sub 1" id="1" />
    </folder>
    <folder name="folder 2" id="2">
        <folder name="sub 2" id="1" />
        <folder name="sub 3" id="2" />
    </folder>
    <file name="file 2" id="2" />
    <file name="file 3" id="3" />
</filesys>


Now, what I want to do is output the following information:
Code:
<html>
<head></head>
<body>
<dl>
<dt>Folders</dt>
<dd>
  <ul>
    <li>folder 1</li>
    <li>folder 2</li>
  </ul>
</dd>
<dt>Files</dt>
<dd>
  <ul>
    <li>file 2</li>
    <li>file 3</li>
  </ul>
</dd>
</dl>
</body>
</html>


I need to do this using XSL.

Basically, I want to output only the direct child elements of the current folder/selected/root item, in this case <filesys>.

Using XPath, I might then pass the following nodeset:
Code:
<?xml version="1.0" ?>
<folder name="folder 1" id="1">
    <file name="File1" id="1" />
    <folder name="sub 1" id="1" />
</folder>


So the output would be:
Code:
Folders
  sub 1
Files
  File1


I've tried everything, but I just can't get this to work.

Please help!
__________________
R.T.F.M - Its the only way to fly...

"No matter what you do, or how good it is, someone will always ask for more features. Or to change the colour of something, then change their minds."

Personal:
experience// 8 Years Web Development
technologies// Standards-compliant, valid, & accessible (x)HTML/CSS, XML/XSL/XPath/XQuery/XUpdate, (OOP) PHP/(My)SQL, eXist/Xindice/XMLDBs
packages// Photoshop, Illustrator, Flash/Fireworks/Director
environment// FC2, MySQL, Lighttpd, PHP5, Mojavi/Agavi
site// //refactored.net/ (Coming soon...)
quote// Programming is the eternal competition between programmers who try to make apps more and more idiot proof and the universe that makes dumber idiots. So far, the universe is winning...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XSL: Grouping of child elements


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT