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

Re: recursive lists displaying grandchildren as childr

Subject: Re: recursive lists displaying grandchildren as children too
From: Joelle Tegwen <tegwe002@xxxxxxx>
Date: Tue, 24 Oct 2006 14:15:27 -0500
Re:  recursive lists displaying grandchildren as childr
I found it. I needed to use
<xsl:apply-templates select="//youth:section[youth:id=$parentID]/child::youth:section"/>


(child instead of descendant)
Joelle

Joelle Tegwen wrote:
I want the results to look like this:


More On Going To School
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_index.asp>:



* Making School Interesting
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_interesting.asp>


* Knowing What I Have to Do
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_haveToDo.asp>


* Knowing Things I Want to Do
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_wantToDo.asp>


* Having a Disability
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_di_index.asp>



o Understanding Tests and Accommodations
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_di_tests.asp>


o My Individuatlized Education Program
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_di_iep_index.asp>



But what I'm getting is this:



More On Going To School
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_index.asp>:



* Making School Interesting
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_interesting.asp>


* Knowing What I Have to Do
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_haveToDo.asp>


* Knowing Things I Want to Do
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_wantToDo.asp>


* Having a Disability
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_di_index.asp>



o Understanding Tests and Accommodations
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_di_tests.asp>


o My Individuatlized Education Program
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_di_iep_index.asp>


* Understanding Tests and Accommodations
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_di_tests.asp>


* My Individuatlized Education Program
<https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_di_iep_index.asp>




Notice that "Understanding Tests and Accommodations <https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_di_tests.asp>" and "My Individuatlized Education Program <https://icitest1.education.umn.edu/joelle/yh-2ndhead/highschool/gs_di_iep_index.asp>" are showing up as children of "Going to School" when they're children of "Having a Disability" How do I make them not show up as children of Going to School?

The xml document is here: http://rafb.net/paste/results/TwIVzn94.html . Xsl stylesheet below.

(note: eventually parentID and sectionID will usually be different and they will be dynamically loaded - not that I know how I'm going to do that yet.)

Thanks much
Joelle Tegwen

My stylesheet looks like 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:variable name="parentID" select="16" />
<xsl:variable name="sectionID" select="16" />
<xsl:variable name="pSection" select="//youth:section[youth:id=$parentID]/ancestor-or-self::youth:section[last()]"/>


<xsl:variable name="location" select="$pSection/youth:folder"/>

<xsl:template match="youth:sitemap">
<html>
<body>
<h2>More On <a>
<xsl:attribute name="href">
<xsl:value-of select="concat('../', $location,'/', $pSection/youth:section/youth:url)"/>
</xsl:attribute>
<xsl:value-of select="$pSection/youth:section/youth:title" /></a>:</h2>
<ul>
<xsl:apply-templates select="//youth:section[youth:id=$parentID]/descendant::youth:section"/>
</ul>
</body>
</html>
</xsl:template>



<xsl:template match="youth:section">
<li><a>
<xsl:attribute name="href">
<xsl:value-of select="concat('../', $location,'/', youth:url)"/>
</xsl:attribute>
<xsl:value-of select="youth:title" /></a>
<xsl:if test="count(./youth:section) &gt; 0">
<ul>
<xsl:apply-templates select="youth:section"/>
</ul>
</xsl:if>
</li>
</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.