Hi, G.Ken.
Thanks a lot for your help. Your XSLT works perfectly.
But this is not exactly what I was looking for (maybe because I've
described my task not clear enough).
1. What if an input XML Document contains a few groups (each of which
contains "PP", "IP" and "PR" elements
connected between each other by the same condition: (PP/IPI/@id =
IP/@id) and (IP/@id-1 = PR/@id))?
When I tested your Stylesheet I've created such input XML Document and
result XML looked like :
<abc>
<PP id="..." id-1="...">
<IPI id="..." id-2="...">
<p1>....</p1>
</IPI>
<IPI id="..." id-2="...">
<p1>....</p1>
</IPI>
</PP>
<PP id="..." id-1="...">
<IPI id="..." id-2="...">
<p1>....</p1>
</IPI>
<IPI id="..." id-2="...">
<p1>....</p1>
</IPI>
</PP>
<IP id="..." id-1="...">
<i1>...</i1>
</IP>
<IP id="..." id-1="...">
<i1>...</i1>
</IP>
<PR id="...">
<r1>...</r1>
</PR>
<PR id="...">
<r1>...</r1>
</PR>
</abc>
My question is: how can I combine them like:
<abc>
<Group>
<PP id="..." id-1="...">
<IPI id="..." id-2="...">
<p1>....</p1>
</IPI>
<IPI id="..." id-2="...">
<p1>....</p1>
</IPI>
</PP>
<IP id="..." id-1="...">
<i1>...</i1>
</IP>
<PR id="...">
<r1>...</r1>
</PR>
</Group>
<Group>
<PP id="..." id-1="...">
<IPI id="..." id-2="...">
<p1>....</p1>
</IPI>
<IPI id="..." id-2="...">
<p1>....</p1>
</IPI>
</PP>
<IP id="..." id-1="...">
<i1>...</i1>
</IP>
<PR id="...">
<r1>...</r1>
</PR>
</Group>
</abc>
where each group contains only elements connected between each other by
condition (above).
Because my task is :
To create for each such group set of output elements.
Each of this output element must contain children value of which should
be generated
from an some attributes and elements of the appropriate group.
Therefore I want those sets of "PP", "IP", and "PR" to be grouped -
just to have a possibility reading this XML to use <xsl:for-each select
="Group">.....</xsl:for-each>.
2. And by the way does it mean that the task (above) must contain two
steps:
a) XSLT-1 which creates XML containing those groups;
b) XSLT-2 which reads this XML and create output elements for each
group.
Or it's possible to perform this in one shot ?
Thank you very much for your help again.