Barney,

Thanks for the explanation and the tips.  I'll pick up xpath and see how far
that gets me!

-Paul


-----Original Message-----
From: Barney Boisvert [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 12, 2005 6:03 PM
To: CF-Talk
Subject: Re: xml breadcrumbs

Try this

<cfset nodeList = xmlSearch(navigationXml, "//[EMAIL PROTECTED]'Tool
2']/ancestor-or-self::*") />

You'll want to change your XML so that it's recursive (use 'item'
instead of 'subitem'), and probably want to switch 'label' to 'id'
since they'll need to be unique so you can do your lookups.

This solution has nothing to do with CF7's XML functions, and
everything to do with the XPath language.  That's why the docs don't
give good examples, they're showing how to use the CFML
implementation, not trying to teach you XPath.  If you're going to be
doing much with XML, you're going to need to pick up a good XPath
tutorial/reference.  Once you've got the basics, the w3c spec is the
definitive reference, but it's thin on examples and techniques.

cheers,
barneyb

On 4/12/05, Paul <[EMAIL PROTECTED]> wrote:
> I'm using a simple xml file for our intranet navigation (CFMX 7). I would
> now like to add breadcrumb navigation (Home > Tools > Tool 1) to each
screen
> by reading the same XML file, and I've never really used XML much.  I'm
> assuming I can use the current path from the browser, find the node that
> matches it, and then search upwards to determine the parent links that
lead
> back to default screen.  But I don't know how to put that plan into
action.
> 
> I've seen many examples in the archives about using a db structure to do
> this, but I'd like to stick w/ xml, if for no other reason than to learn
it
> better.
> 
> I've read the MM docs discussing the new xml functions, but the examples
are
> only one level deep and I'm slow on the uptake, apparently.  An
abbreviated
> version of my xml file follows, hopefully this will be a no-brainer for
some
> of you?
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <navigation>
> 
>             <item label="Home" href="/index.cfm" alt="Home" role="user" />
> 
>             <item label="Tools" href="/tools/index.cfm" alt="Tools"
> role="user">
> 
>                         <subitem label="Tool 1" href="/tools/1.cfm"
> alt="tool 1" role="user" />
> 
>                         <subitem label="Tool 2" href="/tools/2.cfm"
> alt="tool 2" role="user" />
> 
>                         <subitem label="Tool 3" href="/tools/3.cfm"
> alt="tool 3" role="admin" />
> 
>             </item>
> 
>             <item label="Forms &amp; Documents" href="/forms/index.cfm"
> alt="" role="user" />
> 
>             <item label="Administration" href="/admin/index.cfm" alt=""
> role="admin" />
> 
> </navigation>

-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:202570
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to