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

Re: top ancestor value

Subject: Re: top ancestor value
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Fri, 20 Oct 2006 14:58:03 -0700
Re:  top ancestor value
Use:

ancestor-or-self::youth:section[last()]/youth:folder



To learn XPath by just having fun I'm usually recommending the XPath
Visualizer :o)

--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play



On 10/20/06, Joelle Tegwen <tegwe002@xxxxxxx> wrote:
I've been searching on this and I can't find an example that helps. I
find the generic examples but I don't get something that does what I want.

My data is structured so that only the top level of the tree has the
folder for the url. but I want to include that folder in the url for all
of the files (including itself). Based on stuff I've read I thought that
would be "ancestor-or-self::section[last()]/folder," but that gives me
nothing. (full xsl below)

I tried using youth:ancestor-or-self::section[last()]/folder, but that
gives me a validation error.
The data is here: http://rafb.net/paste/results/dyNo4Q36.html for reference

Am I completely misunderstanding ancestor? And in general, how does one
debug this kind of thing?

Thanks again
Joelle

I've got this:
<?xml version="1.0" encoding="ISO-8859-1"?>


<xsl:stylesheet version="1.0" xmlns:youth="http://www.youthhood.org" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
 <html>
 <body>
   <h2>My Sitemap</h2>
   <ul>
     <xsl:for-each select="youth:sitemap//youth:section">
     <li><xsl:value-of select="youth:id" />: <a>
               <xsl:attribute name="href">
                   <xsl:value-of select="concat('../',
ancestor-or-self::section[last()]/folder,'/', youth:url)"/>
                   </xsl:attribute>
               <xsl:value-of select="youth:title" /></a></li>
     </xsl:for-each>
   </ul>
 </body>
 </html>
</xsl:template>
</xsl:stylesheet>

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.