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

RE: What's wrong with my ancestor syntax?

Subject: RE: What's wrong with my ancestor syntax?
From: "Austin, Darrel" <Darrel.Austin@xxxxxxxxxxxxxxxxxx>
Date: Tue, 27 Mar 2007 09:15:56 -0500
RE:  What's wrong with my ancestor syntax?
(OOOPS...sent that last email before finishing...sorry about that...)

> I think you want to know...

Hmm...I don't think I fully explained what I was looking for very well.
;o)

We store out entire site structure in XML. We want to make an RSS feed
that will return the most recently updated pages that fall underneath a
specific node of the menu.

So, if my structure was:

Home
About
 - staff
 - - mary
 - - bob
Contact
Downloads

I want to be able to say "grab the recently updated pages in the 'staff'
section" so I only want to grab staff, mary, and bob, and then sort them
by date.

The more I look at this, the more I'm confused as to if I want to select
descenders or ascenders in the match statement. It appears I could use
both methods via different syntax?

> if the current eleemnt or ancestor
> has a pageID child, so that's
>
> 	<xsl:for-each
> select="*/menuItem[ancestor-or-self::menuItem/pageID = $pageID]">

Hmm...that doesn't quite work either. Here's some specific Xml:

<menuItems>
   <menuItem>
      <pageID>938</pageID>
      <browserTitle>Home Page</browserTitle>
      <lastUpdate>2006/06/12</lastUpdate>
       <menuItem>
         <pageID>998</pageID>
         <browserTitle>District Administration</browserTitle>
         <lastUpdate>2006/06/06</lastUpdate>
       </menuItem>
</menuItems>

I want to pass in the pageID of '938' and, as such, grab both nodes in
the above XML.

I think, in english, I want to say "grab every menuItem that has a
pageID of 938 or is a child of a menuItem with a pageID of 938"

Said that way, I should probably use descendants. I think I'm confused
between the concept of 'is a child of' vs. 'has a parent of'.

-Darrel

Current Thread

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
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.