|
next
|
 Subject: Reformatting Subversion Output svn list ... --xml Author: Tony Lavinio Date: 12 Feb 2007 10:39 AM
|
Oh, it appears you've changed your criteria slightly from when I
first saw the message.
Attached is a way to do it using UL/LI tags; but because the $depth
is being passed down, you could use it to do indenting however you
like.
There are two tricks to reorganizing the tree. One is inferring the
depth from the number of slashes. In XSLT, this can be done by making
a list of all of the characters in the string, and then subtracting
that list from the original string:
translate(name, translate(name, '/', ''), '')
The inner 'translate' removes all slashes, and then the outer one
uses that as the list of characters to remove from the original string,
thus leaving just the slashes. Counting those gives us the depth.
The other part is getting the correct files/directories for each level;
that we do by taking the current path, putting it in a variable with a
slash at the end, and selecting all the entries that begin with that
AND have the appropriate number of slashes, so we don't get stuff from
lower levels.
|
|
|