It's quite difficult to work out exactly what your transformation rules are. I'm afraid sentences like this don't make much sense:
If single paragarph come that instance no need to propagate. more than one paragraph present that time propagate for pervious instance of <DE> and <OR>.
Judging from your sample, if a "Paragraph 1" is empty, you want to add a copy of whatever preceded that "Paragraph 1" header, since the previous paragraph header. Is that a reasonable description?
This transformation is difficult because the true structure of your data is not explicit in the XML. In fact, it's not even clear to me what the true structure is: it's not helped by the use of meaningless tags like DE and OR. But I would start by building a richer hierarchy of elements in which an HR-CP header and its following DE and OR elements are grouped under some parent element. To build that in XSLT 2.0, you will probably want to use <xsl:for-each-group select="*" group-starting-with="HR-CP">. Having created such a hierarchy, it's relatively easy to process it using template rules, where the template rule that matches an empty paragraph-1 copies the content of the preceding-sibling paragraph-1. As a final step, you can then flatten the structure again to a one-dimensional sequence of elements.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|