XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Greg HigginsSubject: Reformatting Subversion Output svn list ... --xml
Author: Greg Higgins
Date: 12 Feb 2007 09:18 AM
Originally Posted: 12 Feb 2007 08:46 AM
I have a subversion repository from which I can get the listing as an xml document. svn list svn://abl.peg.com:4090 --xml -R

I can also get the listing as straight text,
svn list svn://abl.peg.com:4090 -R

I can also walk the repository tree one level at a time by dropping the -R and appending the individual directories.

What I want, is output that looks like this (without the leading dashes because I can't find any way to present formatted text, for some reason the help does npot consider formatting posts a topic worthy of discussion):

techpapers/
--enginecrew/
----Exchange_06_OE_RDBMS_Tuning_03.pdf
----tuning_oe_rdbms_ex_06_final.pdf
----monographs/
------index.html
--------cache/
----------cache.html
----------elephants/
------------elephants.html
...
utilities
--brooman/
...

without having to query the repository for each directory level.

The xml file tells me the difference between files and directories, but it gives each directory as techpapers/enginecrew/monographs/cache and doesn't provide the level information.

My question is, what do I need to know to get what I want?




UnknownPEGPublicSvn.xml
PEG Public Svn Recursive XML Listing

Postnext
Tony LavinioSubject: 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.

Posttop
Tony LavinioSubject: Reformatting Subversion Output svn list ... --xml
Author: Tony Lavinio
Date: 12 Feb 2007 10:39 AM
I should remember to attach the solution too ;)


Documenthiggins.xslt

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.