473,382 Members | 1,447 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Tree xml logic

I need to get this results with this xml tree.

Ciccio-Salvatore
lollo-sasa

How can I do using xsl with a for-each statement ??

<root>
<rossi>
<padre>
<nome>Ciccio</nome>
</padre>
</rossi>
<rossi>
<padre>
<nome>lollo</nome>
</padre>
</rossi>
<verdi>
<padre>
<nome>Salvatore</nome>
</padre>
</verdi>
<verdi>
<padre>
<nome>Sasa</nome>
</padre>
</verdi>

</root>

Aug 31 '06 #1
8 1187
Describe the *logic* of what you want to do, not just the results.
Otherwise people are likely to give you solutions that don't work for
your next data file.
Aug 31 '06 #2
Hi Joseph...
in primis I wriong the group.

in secundis...

If you have not the right solutions...
please dont write anything.

Thanks a lot.
Joseph Kesselman ha scritto:
Describe the *logic* of what you want to do, not just the results.
Otherwise people are likely to give you solutions that don't work for
your next data file.
Aug 31 '06 #3
gh******@gmail.com wrote:
If you have not the right solutions...
please dont write anything.
There are multiple solutions to the question you asked. Which one do you
want?

http://www.catb.org/~esr/faqs/smart-questions.html

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Aug 31 '06 #4
<xsl:for-each
select="/CommandList/CheckRouting/RouterList/Router[Complete='true']//GroupList/Group/OutwardList/Outward"
>
<xsl:variable name="root"
select="/CommandList/CheckRouting/RouterList/Router[Complete='true']/GroupList/Group/ReturnList/Return"
/>

<xsl:variable name="totale">
<xsl:choose>
<xsl:when test="Price/Amount">
<xsl:value-of select="number(Price/Amount) +
number($root/Price/Amount)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//Group/Price/Amount/text()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

</xsl:for-each>
the problem is :

number($root/Price/Amount)
display always the same (first) value

I dont know how get the relative value of OutwardList/Outward with the
ReturnList/Return ones.

Perhaps using ancestor or some axes... ?
you could find the document here...

www.lastminutesud.it/test/901968736.xml
Thanks a lot.

Aug 31 '06 #5
Ghena wrote:
number($root/Price/Amount)
display always the same (first) value
Because $root is always the same set of nodes, and number() returns the
numeric value if the first node in that set.
I dont know how get the relative value of OutwardList/Outward with the
ReturnList/Return ones.
Yes, you need relative paths. The simplest solution is

<xsl:value-of select="number(Price/Amount) +
number(../../OutwardList/Outward/Price/Amount)"/>

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Aug 31 '06 #6
Perhaps is not clear....

Do you mean ?

<xsl:value-of select="number(Price/Amount) +
number(../../ReturnList/Return/Price/Amount)"/>

with your method I get two similar data...

number(Price/Amount) is equal to
.../../OutwardList/Outward/Price/Amount
Joseph Kesselman ha scritto:
Ghena wrote:
number($root/Price/Amount)
display always the same (first) value

Because $root is always the same set of nodes, and number() returns the
numeric value if the first node in that set.
I dont know how get the relative value of OutwardList/Outward with the
ReturnList/Return ones.

Yes, you need relative paths. The simplest solution is

<xsl:value-of select="number(Price/Amount) +
number(../../OutwardList/Outward/Price/Amount)"/>

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Aug 31 '06 #7
Ghena wrote:
number(Price/Amount) is equal to
../../OutwardList/Outward/Price/Amount
In that case, yes, you're in the context of the Outward element, and you
need to navigate up and back down to the Return to find the other value.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Sep 1 '06 #8
gh******@gmail.com wrote:
please dont write anything.
Granted. Plonked and killfiled too.

Sep 1 '06 #9

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

Similar topics

12
by: pillepop2003 | last post by:
Hey! Can anyone give me a hint, how this problem is best implemented: I have a table of users (see below), where every user has one "superior user" (= parent node), this should be a fully...
4
by: Jani Yusef | last post by:
I want to create a tree of processes. The depth of the tree is given by the variable depth and the number of processes started by each node is given by the variable numberOfProcesses. Is the...
6
by: sathyashrayan | last post by:
#include<stdio.h> #include<stdlib.h> #include<string.h> struct tree { int data; struct tree *left,*right; }; void init(struct tree *node)
0
by: zzz | last post by:
a text file inside: (**those line are not sort, it is random**): aaa (number 1) bbb (number 2, reference 1) ccc (number 3, reference 2) ddd (number 4, reference 2) eeee (number 5, reference 4)...
3
by: Toxick | last post by:
Hello experts, I'm a total C# noob with a total C# noob question. I've been Serializing in C++ (MFC) and writing data to std::fstreams for quite some time, so maybe I'm not understanding...
5
by: Daniel | last post by:
I am trying to find all possible routes between two points on a tree using a top to bottom search only. The tree looks like this: ' 1 ' / \ ...
2
by: APEJMAN | last post by:
Hi, would you please guide me with this question? suppose we have a tree with at least 3 nodes containing unique integer values. I want to draw an example tree that justifies my answer and write out...
2
by: Tom | last post by:
My older system: Win2k, VS2005(Academic), .Net 2.0 SP1. Windows.Forms Application: Two splitter panels, a TreeView (named: "tree") in one panel populated with directory name nodes. Logic for...
8
TheServant
by: TheServant | last post by:
Hi Guys, I am trying to get some good logic down on paper, but before I waste my time with this path of thinking I was wondering if you can tell me any majory drawbacks to the logic. Imagine a...
6
by: gskbond | last post by:
Following is my logic to traverse level by level an mway search tree.... (Yeah I finally used templates to implement a queue... :) ) void mWayTree:: TraverseLevelOrder(Node *root,int lvl) {...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.