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

Re: Unexpected result from <a href="...">...</a> in so

Subject: Re: Unexpected result from <a href="...">...</a> in some cases
From: Quinn Taylor <quinntaylor@xxxxxxx>
Date: Tue, 19 Aug 2008 15:05:43 -0600
Re:  Unexpected result from <a href="...">...</a> in so
On Aug 19, 2008, at 2:41 PM, G. Ken Holman wrote:

At 2008-08-19 14:19 -0600, Quinn Taylor wrote:
I've created a recursive template (printRecursivePath) to process a
directory path and build up a string of links from the right side so
as to correctly increase the number of "../" elements for parent link.

Sorry ... I do not understand what you want.

Sorry, I thought that using the commented code might give an idea, and I was aiming for brevity. I'm not just trying to create a relative path from an absolute path. Allow me to clarify...

I'm using this for browsing Subversion repositories hosted from Apache, using the mod_dav_svn module, which provides XML output that can be styled. (For example, http://svn.macosforge.org/repository/macports/trunk/www/ uses the default XSL file, which I find pretty hideous.) I'm trying to make it easier to link directly to any directory along the path, and any path should include spaces on either side of the slashes, and a "[root]" link at the beginning.

For an example of what I'm talking about, compare the default HTML (http://svn.collab.net/repos/svn/trunk/doc/ ) with the output produced by ViewVC (http://svn.collab.net/viewvc/svn/trunk/doc/ ), specifically the gray bar on the top of the latter.

What result to you expect for your test string "/path/to/resource"?

<a href="../../../">[root]</a> / <a href="../../">path</a> / <a href="../">to</a> / resource

What result to you expect for "/to/resource"?

<a href="../../">[root]</a> / <a href="../">to</a> / resource

What result to you expect for "/resource"?

<a href="../">[root]</a> / resource

What result to you expect for "resource"?

I don't handle this one, since all my paths provided by subversion will have a leading / to indicate the full repository path.

The problem occurs for path components between the first and the last

Because you are not passing your intermediate results to the recursively called template.

Actually, all the text which is generated by a recursive call to the template is saved in a variable using this chunk of code:

<!-- Make a tail-recursive call and store the text result in a variable -->
<xsl:variable name="recursiveResult">
<xsl:call-template name="printRecursivePath">
<xsl:with-param name="text" select="$tail"/>

If you run my code with the commented code un-commented, you can actually see that $parentPath has the value I want, it just isn't printing out what I need.


But I'm only guessing what you want from your succinct description. If you give some examples then someone on the list can probably guide you to the right result.

For now, though, look at what I'm doing below when I pass the intermediate results to the called template ... that may be the bit you are missing. When I write recursive templates I always need to keep track of what is being built along the way, or the intermediate work gets lost. This appears to be the evidence you are presenting, so I'm guessing that is your issue.

Note that even what I have below is incomplete since I don't know what you want to do with "resource" as your input path.

I hope this helps.

. . . . . . . . . . . . Ken

Since I didn't fully explain what I hoped to see, the code you sent doesn't directly solve my problem, but does have some nice things I can glean to hopefully make mine cleaner and more robust.

 - Quinn


Current Thread


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.
First Name
Last Name
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.