attrybutes from higher elements XSLT

R

Ruthless

Hello.
I've got a question.
I've got family tree in XML.

It looks like this
<generation level="2">
<single><person>...</single>
<marriage><preson>...</person><person>....</person></marriage>

<person> inside single and marriage is the same element,
marriage has 2 elements of <person>(quite obvious :))

I've got XSLT displaying all persons(single and marriage both) from all
levels but i'd also like to display their level in family tree.
e.g.
<tr><td>first_name</td><td>last_name</td><td> level</td> ... etc... </tr>

But i don'y know how to ommit the <single> or <marriage> element and go
straight to generation@level

Generation is recursive, <marriage> can have <children> who strats new
<generation> of level="parents_level+1"

And the second question how can i check whether or not <person> is inside
<single who="name1"> or <marriage who="name1 with name2"> element and how to
get the @who attribute?

thanx in advance
greetings R
 
D

Dimitre Novatchev

Ruthless said:
Hello.
I've got a question.
I've got family tree in XML.

It looks like this
<generation level="2">
<single><person>...</single>
<marriage><preson>...</person><person>....</person></marriage>

<person> inside single and marriage is the same element,
marriage has 2 elements of <person>(quite obvious :))

I've got XSLT displaying all persons(single and marriage both) from all
levels but i'd also like to display their level in family tree.
e.g.
<tr><td>first_name</td><td>last_name</td><td> level</td> ... etc... </tr>

But i don'y know how to ommit the <single> or <marriage> element and go
straight to generation@level
Use:

../../@level


Generation is recursive, <marriage> can have <children> who strats new
<generation> of level="parents_level+1"

And the second question how can i check whether or not <person> is inside
<single who="name1"> or <marriage who="name1 with name2">
element

Use:
../self::single

to select the parent if it is "single"

or use

../self::marriage

to select the parent if it is "marriage"


and how to
get the @who attribute?

../@who

Dimitre Novatchev.
FXSL developer, XML Insider,

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top