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

Clever ideas to do toc...

  • From: Andrew Bunner <bunner@m...>
  • To: xml-dev@i...
  • Date: Tue, 08 Sep 1998 09:26:07 -0700

clever ideas

  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/

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.