rshk2001
asked on
Section nesting
All:
How do you I transform below through xsl:
Input
<?xml version='1.0' encoding='utf-8'?>
<book>
<section order="1"><p>Section 1: para</p></section>
<section order="1">
<p>Section 1: para</p>
<section order="2">
<p>Section 2: para</p>
<section order="4">
<p>Section 4: para</p>
</section>
</section>
</section>
<section order="1">
<p>Section 1: para</p>
<section order="2"><p>Section 2: para</p></section>
</section>
<dont>
<section order="1">
<p>not to touch</p>
</section>
</dont>
</book>
output:
<?xml version='1.0' encoding='utf-8'?>
<book>
<section order="1"><p>Section 1: para</p></section>
<section order="1">
<p>Section 1: para</p>
<section order="2">
<p>Section 2: para</p>
<section order="3">
<section order="4">
<p>Section 4: para</p>
</section>
</section>
</section>
</section>
<section order="1">
<p>Section 1: para</p>
<section order="2"><p>Section 2: para</p></section>
</section>
<dont>
<section order="1">
<p>not to touch</p>
</section>
</dont>
</book>
But when I try with node position it always returns a different one. Pl advise. Moreover, order values goes upto "n" values of depth.
Thanks
How do you I transform below through xsl:
Input
<?xml version='1.0' encoding='utf-8'?>
<book>
<section order="1"><p>Section 1: para</p></section>
<section order="1">
<p>Section 1: para</p>
<section order="2">
<p>Section 2: para</p>
<section order="4">
<p>Section 4: para</p>
</section>
</section>
</section>
<section order="1">
<p>Section 1: para</p>
<section order="2"><p>Section 2: para</p></section>
</section>
<dont>
<section order="1">
<p>not to touch</p>
</section>
</dont>
</book>
output:
<?xml version='1.0' encoding='utf-8'?>
<book>
<section order="1"><p>Section 1: para</p></section>
<section order="1">
<p>Section 1: para</p>
<section order="2">
<p>Section 2: para</p>
<section order="3">
<section order="4">
<p>Section 4: para</p>
</section>
</section>
</section>
</section>
<section order="1">
<p>Section 1: para</p>
<section order="2"><p>Section 2: para</p></section>
</section>
<dont>
<section order="1">
<p>not to touch</p>
</section>
</dont>
</book>
But when I try with node position it always returns a different one. Pl advise. Moreover, order values goes upto "n" values of depth.
Thanks
ASKER
Gertone:
I am looking for grouping of sections based on the attribute value. Eg: The place where I added <section order="3"> is an hierarchy/depth of section level. Basically the order follows as: level 1, level 2, level 3..., when level 4 follows immediately after level 2 (ie <section order="2">) then a third order level is introduced before level 4 and that explains the above structure.
Thanks
I am looking for grouping of sections based on the attribute value. Eg: The place where I added <section order="3"> is an hierarchy/depth of section level. Basically the order follows as: level 1, level 2, level 3..., when level 4 follows immediately after level 2 (ie <section order="2">) then a third order level is introduced before level 4 and that explains the above structure.
Thanks
OK, I see, can you use XSLT2, or should this be done using XSLT1?
ASKER
xslt1
OK, I need more insight in the restrictions then.
Can I have a section 6 in a section 3, so that I have to add 4 AND 5?
Can I have a section 6 in a section 3, so that I have to add 4 AND 5?
and what is the logic with the P?µ
All P before the first section inside a section are left outside the grouping section,
or do you just need a wrapper around the subsection itself?
How do you deal with this?
<section order="2">
<p>Section 2: para</p>
<p>Section 2: para</p>
<section order="4">
<p>Section 4: para</p>
</section>
<section order="4">
<p>Section 4: para</p>
</section>
</section>
and can this happen?
<section order="2">
<p>Section 2: para</p>
<section order="4">
<p>Section 4: para</p>
</section>
<p>Section 2: para</p>
<section order="4">
<p>Section 4: para</p>
</section>
<p>Section 2: para</p>
</section>
and if so, how do you want to deal with it?
I must say that based on your extreme flood of communication,
this is more an analysis task than a development task :-)
All P before the first section inside a section are left outside the grouping section,
or do you just need a wrapper around the subsection itself?
How do you deal with this?
<section order="2">
<p>Section 2: para</p>
<p>Section 2: para</p>
<section order="4">
<p>Section 4: para</p>
</section>
<section order="4">
<p>Section 4: para</p>
</section>
</section>
and can this happen?
<section order="2">
<p>Section 2: para</p>
<section order="4">
<p>Section 4: para</p>
</section>
<p>Section 2: para</p>
<section order="4">
<p>Section 4: para</p>
</section>
<p>Section 2: para</p>
</section>
and if so, how do you want to deal with it?
I must say that based on your extreme flood of communication,
this is more an analysis task than a development task :-)
ASKER
Gertone: Pl find below
<section order="2">
<p>Section 2: para</p>
<p>Section 2: para</p>
<section order="3">
<section order="4">
<p>Section 4: para</p>
</section>
<section order="4">
<p>Section 4: para</p>
</section>
</section>
</section>
>> and can this happen? - Yes and below is the tagging structure
<section order="2">
<p>Section 2: para</p>
<section order="3">
<section order="4">
<p>Section 4: para</p>
</section>
</section>
<p>Section 2: para</p>
<section order="3">
<section order="4">
<p>Section 4: para</p>
</section>
</section>
<p>Section 2: para</p>
</section>
Yes, if level 6 occurs then level 5 and level 4 must wrap before level 6.
Thanks
<section order="2">
<p>Section 2: para</p>
<p>Section 2: para</p>
<section order="3">
<section order="4">
<p>Section 4: para</p>
</section>
<section order="4">
<p>Section 4: para</p>
</section>
</section>
</section>
>> and can this happen? - Yes and below is the tagging structure
<section order="2">
<p>Section 2: para</p>
<section order="3">
<section order="4">
<p>Section 4: para</p>
</section>
</section>
<p>Section 2: para</p>
<section order="3">
<section order="4">
<p>Section 4: para</p>
</section>
</section>
<p>Section 2: para</p>
</section>
Yes, if level 6 occurs then level 5 and level 4 must wrap before level 6.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I see that you added a section3, but what is the logic behind it?
I would like to help but have no clue where the question is