[
Lists Home |
Date Index |
Thread Index
]
- From: Andrew Bunner <bunner@massquantities.com>
- To: xml-dev@ic.ac.uk
- Date: Tue, 08 Sep 1998 09:26:07 -0700
Let's say I'm describing the hiearchy of our web site in an XML
document like so...
<site-map>
<page
title="Section
1"
url="1.html">
<page
title="Page
1.1"
url="1.1.html"/>
<page
title="Page
1.2"
url="1.2.html"/>
</page>
<page
title="Section
2"
url="2.html">
<page
title="Page
2.1"
url="2.1.html"/>
<page
title="Page
2.2"
url="2.2.html"/>
</page>
<page
title="Section
3"
url="3.html">
<page
title="Page
3.1"
url="3.1.html"/>
</page>
</site-map>
In a given section, the user has links to all the other pages in
that section as well as top-level links to the other sections. In other
words, I only want to "expand" the section that the user is
currently in.
An XML document that's a part of this hiearchy has some tag that
says where it fits in. Maye 1.1.xml will have <page title="Page
1.1"/> or something... (e.g.
<document-root>&entity-that-expands-to-site-map;<page
title="Page 2.1"/></document-root>
In the XSL proposal, I'd have a field day writing a nifty Java
Script function to do exactly this... in the new world, I'm not sure it
can be done at all.
The crux of the problem is that I don't know how to make the
<xsl:if test="..."> compare the contents or attribute
values of one tag to the content or attribute values of another tag. It
appears as though the only thing you can do is with the test attribute is
test the position of a tag relative to other tags and what attributes it
has.
I'd like to do something like this...
1: <xsl:for-each
select="site-map/page">
2: <A
HREF="{attribute(url)}">
3: <xsl:value-of
expr="attribute(title)"/>
4: </A>
5: <xsl:if
test=".[attribute(title)]='value
of page title for this
document'">
6: <xsl:for-each
select="page">
. <A
HREF="{attribute(url)}">
. <xsl:value-of
expr="attribute(title)"/>
. </A>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
Obviously, line 5 needs some work. If anyone has any ideas or
suggestions on how to reach the goal of spitting out something like the
table below, I would be very grateful...
<A
HREF="1.html">Section
1</A>
<A
HREF=2.html">Section
2</A>
<A
HREF=2.1.html">Page
2.1</A>
<A
HREF=2.2.html">Page
2.2</A>
<A
HREF="3.html">Section
3</A>
-- Andrew
Andrew Bunner
President, Founder Mass Quantities, Inc.
Professional Supplements for the Perfect
Physique
http://www.massquantities.com
|