xsl-list
[Top] [All Lists]

RE: Fwd: How to list items

2003-07-01 13:50:09
The first part of your question looks like a classic "flatten-the-hierarchy" problem, 
while the second is another grouping issue where you want to traverse the ancestor axis and pick up 
the elements whose name is "Class". Does anyone else see it this way?

See http://sources.redhat.com/ml/xsl-list/2000-07/msg00463.html, and more 
generally, http://www.jenitennison.com/xslt/hierarchies-in.html. If you can't 
make any sense of it, and no one else replies with more specific information, 
get back to the list and I'll work on this specific case with you.
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     David Ohlemacher <ohlemacher(_at_)bbn(_dot_)com>
Sent:     Tue, 01 Jul 2003 15:44:06 -0400
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:  [xsl] Fwd: How to list items

Hi everyone,

I am new to XSL and this list. This example isn't exactly what I need but it is close and simpler to explain.

== BACKGROUND = Assume we have the XML file below that contains any number of classes each of which have any number of subclasses. Also subclasses can have subclasses, etc.

== QUESTION = Is it possible to write a XSL sheet to list each class and under the class write an indented list of the subclasses for it? The thing that makes this difficult is that the subclass lists may have class entries for classes that have not yet been listed (or never will be). I would further like an additional list of superclasses (not shown) for each class.

TIA,
-d


<!------------- myOutput.txt -------------->
classA
        classA_1 classA_2 ...  classA_n classZ_1
classA_1
        classA_1_1
classA_1_1

..
classA_n
..
classZ
        classZ_1 classA_n
classZ_1
..
classZ_n




<!--------------- myFile.xml ---------------->
<ontology id="">
<Class id="classA">
        <comment>blah blah</comment>
        <subClassOf>
                <Class id="classA_1">
                        <comment>blah blah</comment>
                        <subClassOf>
                                <Class id="classA_1_1">
                                        <comment>blah blah</comment>
                                </Class>
                        </subClassOf>
                </Class>
        </subClassOf>
        .
        .
        .
        <subClassOf>
                <Class id="classA_n">
                        <comment>blah blah</comment>
                </Class>
        </subClassOf>
        <subClassOf>
                <Class id="classZ_1">
                        <comment>blah blah</comment>
                </Class>
        </subClassOf>
</Class>
.
.
.
<Class id="classZ">
        <subClassOf>
                <Class id="classZ_1">
                        <comment>blah blah</comment>
                </Class>
        </subClassOf>
        .
        .
        .
        <subClassOf>
                <Class id="classA_n">
                        <comment>blah blah</comment>
                </Class>
        </subClassOf>
</Class>
</ontology>

XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>