[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: most efficient flat file listing to hierarchical
George Cristian Bina wrote:
Abel, Ah, forgot to mention, you are right. I cheated: I first "corrected" the list, but left it out of the solution... Since it uses following-sibling[1] to check if a file/directory belongs to the same node, it can only work when the list is ordered in a certain way. Analyzing the input, I assumed directory order (like, output of dir, or ls) which is: directory first, then files, then subdirectories. I figured the OP had put the "cn" entry erroneously at the end, so I corrected it like this: <item>cn</item> <item>cn/test.xml</item> <item>en</item> <item>en/test.html</item> <item>en/test1.html</item> <item>en/resource</item> <item>en/resource/style</item> <item>en/resource/style/test.css</item> <item>favicon.ico</item> In addition, it assumes that a dot in the name is a file, which is not ideal. It were better if a directory is considered a directory when it occurs more than once. Which still does not solve the favicon.ico, which can be either a directory or a file. I choose the latter for ease of implementation. To make my solution working with any order of input, some adjustments must be made. I tried a few, and I am sure it can be done, but got a bit entangled while trying to keep the solution short and with pure match templates. No doubt I would end above my 12 lines ;-) -- Abel
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|