If we get @more="1" attribute in the roll element then <more> element should be add just <following-sibling> of <student>.
if @more="2" attribute the add<more> element should be add in the both <following-sibling> <student> element
Input XML:
<kk>
<kita>
<student>
<roll>content here</roll>
<roll>content here</roll>
<roll>content here</roll>
<roll more="1">content here</roll>
</student>
<student>
<roll>content here</roll>
<roll>content here</roll>
<roll>content here</roll>
<roll>content here</roll>
</student>
<student>
<roll>content here</roll>
<roll>content here</roll>
<roll>content here</roll>
<roll>content here</roll>
</student>
</kita>
</kk>
XSL file:
There are more code in xsl, Just i copied here:
<xsl:if test="parent::student[parent::kita]/following-sibling::student/x:roll[@more]">
<more/>
</xsl:if>
Expected output:
<?xml version="1.0" encoding="UTF-8"?>
<kk>
<kita>
<student>
<roll>content here</roll>
<roll>content here</roll>
<roll>content here</roll>
<roll more="1">content here</roll>
</student>
<student>
<!-- if @more="1" or @more="2" add <more> element-->
<more>Content here</more>
<roll>content here</roll>
<roll>content here</roll>
<roll>content here</roll>
<roll>content here</roll>
</student>
<student>
<!-- If @more="2" add <more> element below-->
<more>Content here</more>
<roll>content here</roll>
<roll>content here</roll>
<roll>content here</roll>
<roll>content here</roll>
</student>
</kita>
</kk>