|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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... |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XSL: Grouping of child elements |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|