As per suggestions, posting this question in a seperate thread. The question is a continuation, to the below link
xslt-loop-count-context-value-from-top-xml
We wanted to produce the below xml as output(some changes in the outputxml). the tag, “errorsandwarnings” should be present in case atleast one error or warning is present,”allerrors” tag when atleast one error is present, “allwarnings” tag when atleast one warning is present
<Root>
<errorsandwarnings>
<allerrors>
<error>apple</error>
<error>apple</error>
</allerrors>
<allwarnings>
<warning>apple</warning>
</allwarnings>
</errorsandwarnings>
<success>apple</success>
</Root>
This transformation:
when applied on the XML document provided in the previous question:
produces the wanted, correct result: