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

RE: Hierarchy

  • From: Newsha Makooi <Newsha@i...>
  • To: "'xml-dev@l...'" <xml-dev@l...>
  • Date: Tue, 11 Jul 2000 14:52:06 -0600

newsha makooi
Title: RE: Hierarchy

Thanks for the info.  I am a bit confused about the second step you mentioned.  Do you see the <path="x/y/z"> parsed out as

<folder name="x"/><folder name="y"/><folder name="z"/>

        -OR-

<folder name="x">
        <folder name="y">
                <folder name="z">
                </folder>
        </folder>
</folder>
??

Then, the grouping would happen, right?
------------
Also, I could not find any examples for Preceding-Sibling. Just an explanation on page 736 (XSLT, Programmer's Reference).  Where can I find more info on Preceding-Sibling/Following-Sibling?

PS
Just to clarify my objective, I am using an XML document which has a listing of files and their location (absolute, such as Root\Folder1\Folder2\Folder3).  Each file has its own Path.  The XML feed has these files all over without any order.  I am trying to use XSLT to build a new XML document which groups all files that belong to the same folder Path.  So, I'll need to build a new XML tree structure and 'stick' the incoming XML entries into their appropriate location, thereby building hierarchy into the resulting XML.

Also, I am using MSXML3.

Thanks.
Newsha

-----Original Message-----
From: Kay Michael [mailto:Michael.Kay@i...]
Sent: Friday, July 07, 2000 2:30 AM
To: 'Newsha Makooi'
Subject: RE: Hierarchy


This kind of grouping problem is never easy in XSLT, and this is one of the
more complex ones! I think I'd break it up into several passes, either using
a sequence of stylesheets or using the node-set() extension (create a result
tree fragment, then process it further). The first pass might sort by path,
as you've already done, the second might parse the path (so path="x/y/z"
becomes <folder name="x"><folder name="y"><folder name="z">, and the third
might do grouping of adjacent entries that belong to the same folder: this
is then a classic grouping which you can do as
 
<xsl:for-each
select="folder[not(@name=preceding-sibling::folder[1]/@name)]">
   <folder name="{@name}">
       <xsl:for-each select="self::* |
following-sibling::folder[@name=current/@name]">
          [folder details]
 
Then the next trick is for this template to be applied recursively to each
level of folder.
 
Hope these ideas help.
 
Mike
 
 
 -----Original Message-----
From: Newsha Makooi [mailto:Newsha@i...]
Sent: 07 July 2000 01:17
To: 'Kay Michael'
Subject: Hierarchy



Hi Michael,

Sorry I am writing to you directly, but I think I am running out of options
and I needed your guidance if you have the time.

I am dealing with the following XML document (ZDocList.xml).

In my XSL document (TOC.xsl), I sort the XML document in order to group all
the elements.  Next, I would like to build a hierarchy based on the
FolderPath for all of the document entries.  But the XSL that I have only
builds the hierarchy for that node!  I want all of the nodes to be put into
the hierarchy based on their FolderPath.

In essence I want to end up with something similar to this:

<TOC>
        <entry folderpath="Level1">
                <entry folderpath="Level2">
                        <entry folderpath="">actual document</entry>
                </entry>
                <entry folderpath="Level2">
                        <entry folderpath="">actual document</entry>
                        <entry folderpath="">actual document</entry>
                        <entry folderpath="">actual document</entry>
                </entry>
        </entry>
        <entry folderpath="Level1">
                <entry folderpath="Level2">
                        <entry folderpath="">actual document</entry>
                        <entry folderpath="">actual document</entry>
                        <entry folderpath="">actual document</entry>
                </entry>
        </entry>
</TOC>

How can I get the above from what I have so far?  Would you please direct
me? 

Please ignore this if it takes too much of your time.  I don't want to be a
bother.  Support@Wrox has not been able to help because it does not pertain
to 'source code' mistakes in a book.

Thanks for your time and assistance.

Regards,
Newsha 

 


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.