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

Re: XML/XSL BreadCrumb Trail

Subject: Re: XML/XSL BreadCrumb Trail
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 27 Aug 2003 05:18:14 -0700 (PDT)
xsl breadcrumb
This transformation:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:z="z:z" xmlns:rs="rs/rs"
 >
 <xsl:output method="text"/>
 
  <xsl:template match="/">
    <xsl:call-template name="trail">
      <xsl:with-param name="pNode" select="/*/*[@PageID='1003']"/>
    </xsl:call-template>
  </xsl:template>
  
  <xsl:template name="trail">
    <xsl:param name="pNode" select="."/>
    <xsl:param name="pTrace"/>
    
    <xsl:for-each select="$pNode[1]">
      <xsl:variable name="vParent" 
      select="../*[@PageID = current()/@ParentID]"/>
      
      <xsl:choose>
        <xsl:when test="$vParent">
          <xsl:call-template name="trail">
            <xsl:with-param name="pNode" 
                 select="$vParent"/>
            <xsl:with-param name="pTrace"
             select="concat(' > ', @PageTitle, $pTrace)"/>
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="concat(@PageTitle, $pTrace)"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

when applied on a well-formed variation of your example xml:

<rs:data xmlns:z="z:z" xmlns:rs="rs/rs">
  <z:row PageID="1000" ParentID="0" PageTitle="Home"/>
  <z:row PageID="1001" ParentID="1000" PageTitle="Page1"/>
  <z:row PageID="1002" ParentID="1000" PageTitle="Page2"/>
  <z:row PageID="1003" ParentID="1001" PageTitle="Page1.1"/>
</rs:data>

produces the wanted result:


Home > Page1 > Page1.1




---- "Bjorn Aune" <fortgjort@xxxxxxx> wrote:

Im having problems with developing a solution for breadcrumb trail 
(navigation path - home > page 1 > page 1.1 > etc...) with xml data
and xsl.

The data is stored in a sql server and is placed in a XMLDOM 
object......objRS.Save objXML, adPersistXML. The XML data is just a 
recordset containing all the pages for the website.

Each row in the XML contains the following attributes/values:
- PageID
- ParentID
- PageTitle

<rs:data>
<z:row PageID="1000" ParentID="0" PageTitle="Home"/>
<z:row PageID="1001" ParentID="1000" PageTitle="Page1"/>
<z:row PageID="1002" ParentID="1000" PageTitle="Page2"/>
<z:row PageID="1003" ParentID="1001" PageTitle="Page1.1"/>
....
....
</rs:data>

In the XSL(T) object i have included some ASP parameters, the current PageID 
and the parent PageID for the current page.

How should I design the XSL template to be able to get the following output 
(if the current PageID = 1003):

Home > Page1 > Page1.1

Hope to hear from you!!

_________________________________________________________________
Hotmail snakker ditt språk! 
http://www.hotmail.msn.com/cgi-bin/sbox?rru=dasp/lang.asp - Få Hotmail på 
norsk i dag




=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.