473,668 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSL question-- walking a hierarchy

Sorry for the basic nature of this question. I know XSL can do this, but I
don't recall a good method...

Say I have an xml structure like this:

<folder_structu re>
<folder name="folder1">
<file name="myfile"/>
</folder>
<folder name="folder2">
</folder>
<folder name="folder3">
<file name="somefile"/>
<file name="anotherfi le"/>
</folder>
<folder name="folder4">
<folder name="folder5">
<file name="newfile"/>
</folder>
</folder>
</folder_structur e>
I need to use XSL to whip up a series of file paths, like this:

folder1\myfile
folder3\somefil e
folder3\another file
folder4\folder5 \newfile

I'm having trouble with walking the subfolders; for instance, the
folder4\folder5 path above.

The file paths can be arbitrarily deep, and I'm stumped on how to create a
file <xsl:template > that recuruses up the tree and pulls all the parent
folder names. If you have any advice, I'd be grateful. Thanks.

Jul 20 '05 #1
4 1630
http://www.topxml.com/code/default.a...20010323001030
Dimitre Novatchev.
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
"Jim Bancroft" <bo*********@no spam.yahoo.com> wrote in message
news:e9******** *********@news. uswest.net...
Sorry for the basic nature of this question. I know XSL can do this, but I don't recall a good method...

Say I have an xml structure like this:

<folder_structu re>
<folder name="folder1">
<file name="myfile"/>
</folder>
<folder name="folder2">
</folder>
<folder name="folder3">
<file name="somefile"/>
<file name="anotherfi le"/>
</folder>
<folder name="folder4">
<folder name="folder5">
<file name="newfile"/>
</folder>
</folder>
</folder_structur e>
I need to use XSL to whip up a series of file paths, like this:

folder1\myfile
folder3\somefil e
folder3\another file
folder4\folder5 \newfile

I'm having trouble with walking the subfolders; for instance, the
folder4\folder5 path above.

The file paths can be arbitrarily deep, and I'm stumped on how to create a
file <xsl:template > that recuruses up the tree and pulls all the parent
folder names. If you have any advice, I'd be grateful. Thanks.


Jul 20 '05 #2
Thanks, Dimitre.

I'm still a little unclear on how I'm supposed to use your snippet-- do
I paste it whole into my XSL code somewhere, then pass my node into it?
"Dimitre Novatchev" <dn********@yah oo.com> wrote in message
news:bu******** ****@ID-152440.news.uni-berlin.de...
http://www.topxml.com/code/default.a...20010323001030
Dimitre Novatchev.
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html


Jul 20 '05 #3

"Jim Bancroft" <bo*********@no spam.yahoo.com> wrote in message
news:wS******** ********@news.u swest.net...
Thanks, Dimitre.

I'm still a little unclear on how I'm supposed to use your snippet-- do I paste it whole into my XSL code somewhere, then pass my node into it?


In the snippet there is:

<xsl:variable name="theParmNo des" select="//namespace::*[local-name() =
'myNamespace']"/>

This causes the code to produce XPath expressions for all namespace nodes
having prefix 'myNamespace'.

If you want to get the XPath expression for a specific node, it should be
specified as the "theParmNod es" xsl:param

Of coourse, it is best to group the snippet into a named template, so that
it can be called from different places simply with

<xsl:with-param name="theParmNo des" select="."/>

Dimitre Novatchev.
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
Jul 20 '05 #4
Ah, got it-- thanks again, Dimitre.

-Jim

In the snippet there is:

<xsl:variable name="theParmNo des" select="//namespace::*[local-name() =
'myNamespace']"/>

This causes the code to produce XPath expressions for all namespace nodes
having prefix 'myNamespace'.
<.....>


Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1475
by: Gonçalo Rodrigues | last post by:
Hi all, (note: newbie alert) Suppose you have a hierarchy of objects that you deal with via smart pointers, e.g. something like: template<typename T> class Ref { private:
8
3203
by: John Lee | last post by:
Hi, If I want to check permission on each public method of a web service, (assume the checking routine is ready to use and called AccessCheck) , one way of doing it is to call this AccessCheck on top of each public method, I want to implement it in different way but seems missing something - I want to develop a custom attribute, let's say SecurityCheckEnabledAttribute with only Yes/No parameter, then create a base class for all web...
21
1975
by: Mark Broadbent | last post by:
Consider the following statements //------- Item i = Basket.Items; //indexer is used to return instance of class Item Basket.Items.Remove(); //method on class item is fired item i = new ("Pear"); Basket.Items.Add(item); //------
0
1564
by: Irfan Akram | last post by:
Hello People, I would appreciate your responses on this. I am writing an asp.net web-application involving C#. I am actually building a test hierarchy at the moment, which involves producing dynamic controls, depending on user response. To be more precise, I prompt the user for the number of questions, that should be in the test. He types in a number, say 10. Then I need to ask him
6
1498
by: Jackson | last post by:
I've got an inheritance question and was hoping brighter minds could guide me. I am in the strange situation where some of the methods in a subclass are actually more general than methods in a superclass. What is the preferred way to handle such situations. My original thought was to do something like this: class AA(object): def general_method(): pass class A(AA):
8
2110
by: Ben Hallert | last post by:
Hi guys! I'm working on a little javascriptlet/greasemonkey script, and I've run into a challenge that I think can be solved with walking the DOM, but I feel like I'm kludging my way through and wondering if there might be a better answer out there. Here's the problem: I want to insertCell(0) into an existing table, but the table doesn't have a NAME or ID. I don't have the option of adding these (it's for Wikipedia) and would like to...
10
331
by: Francois Malgreve | last post by:
Hello everybody, I have a pretty straightforward question regarding namespace. Is there anyone who knows why the following code does not compile on the line Type t = typeof(Name6.Name7.Name6.Class6) ? I am using Visual Studio 2006 by the way (.Net 2.0) As far as I know "Name6.Name7.Name6" is a valid namespace but, somehow, some operations on that namespace will not compile. From the example, we can
11
1392
by: Simon Woods | last post by:
Hi I have this recursive function and I want to walk the inheritance hierarchy to set field values .... the generic T is constrainted as the base class of the inheritance hierarchy Friend Shared Function InjectFieldValues(ByVal p_def As T, ByVal p_properties As PropertyMaps) As T
2
2693
by: Rob Kirkpatrick | last post by:
Hi All, I just finished debugging some code where I needed to determine why one subclass had a bound method and another did not. They had different pedigree's but I didn't know immediately what the differences were. I ended up walking the hierarchy, going back one class at a time through the code, for the two subclasses (hierarchy ~7 classes deep each) to see whom they inherited from. Short of writing this down on
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8371
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8652
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2782
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.