shellscript to find a line in between a particular set of lines of a text file

i have a file a.txt and following is only one portion.
I want to search <branch value="/dev36/AREA/" include="yes"></branch> present in between
<template_file name="Approve External" path="core/approve/bin" and </template_file>
where the no of lines containing "<branch value= " is increasing

file contents:-

CTYPE available_templates SYSTEM './available_templates.dtd'>

<available_templates>

<template_file name="Approve External" path="core/approve/bin"
<command_list>
<command value="new_job"></command>
<command include="no" value="all"></command>
</command_list>
<role_list>
<role allusers="yes" include="yes" value="admin"></role>
<role allusers="yes" include="yes" value="master"></role>
<role allusers="yes" include="yes" value="editor"></role>
<role include="no" value="all"></role>
</role_list>
<branch_list>
<branch value="all" include="no"></branch>
<branch value="/devAREA/" include="yes"></branch>
<branch value="/upgrade_test/AREA/include="yes"></branch>
<branch value="/dev4/AREA/" include="yes"></branch>
<branch value="/dev36/AREA/" include="yes"></branch>
<branch value="/dev05/" include="yes"></branch>
<branch value="/mandsmoney/AREA/" include="yes"></branch>
</branch_list>
</template_file>
<template_file ="Workflow" path="core/sanj"
<command_list>
<command value="new_job"></command>
<command include="no" value="all"></command>
</command_list>
<role_list>
<role allusers="yes" include="yes" value="editor"></role>
<role allusers="yes" include="yes" value="admin"></role>
<role allusers="yes" include="yes" value="master"></role>
<role include="no" value="all"></role>
</role_list>
<branch_list>
<branch value="all" include="no"></branch>
<branch value="/devAREA/" include="yes"></branch>
<branch value="/upgrade_test/AREA/include="yes"></branch>
<branch value="/dev4/AREA/" include="yes"></branch>
<branch value="/dev36/AREA/" include="yes"></branch>
<branch value="/dev05/" include="yes"></branch>
<branch value="/mandsmoney/AREA/" include="yes"></branch>
</branch_list>

</template_file>

Please help me write a shellscript

"where the no of lines containing "<branch value= " is increasing " Means??

Can you provide with the expected output of the input you provided.??
Is below what u expect??

$ cat inphtml | sed -n '/<template_file name="Approve External" path="core\/approve\/bin"/,/<\/template_file>/ {
> /<branch value="\/dev36\/AREA\/" include="yes"><\/branch>/p
> }
> '

Output:
<branch value="/dev36/AREA/" include="yes"></branch>

----------------------

$ cat inphtml | sed -n '/<template_file name="Approve External" path="core\/approve\/bin"/,/<\/template_file>/ {
> /<branch value=/p
> }
> '

Output:

<branch value="all" include="no"></branch>
<branch value="/devAREA/" include="yes"></branch>
<branch value="/upgrade_test/AREA/include="yes"></branch>
<branch value="/dev4/AREA/" include="yes"></branch>
<branch value="/dev36/AREA/" include="yes"></branch>
<branch value="/dev05/" include="yes"></branch>
<branch value="/mandsmoney/AREA/" include="yes"></branch>

shellscript to find a line betwwen particular set of a lines

i have a file a.txt and following is only one portion.
I want to search <branch value="/dev36/AREA/" include="yes"></branch> present in between
<template_file name="Approve External" path="core/approve/bin" and </template_file>
where the no of lines containing "<branch value= " is increasing

CTYPE available_templates SYSTEM './available_templates.dtd'>

<available_templates>

<template_file name="Approve External" path="core/approve/bin"
<command_list>
<command value="new_job"></command>
<command include="no" value="all"></command>
</command_list>
<role_list>
<role allusers="yes" include="yes" value="admin"></role>
<role allusers="yes" include="yes" value="master"></role>
<role allusers="yes" include="yes" value="editor"></role>
<role include="no" value="all"></role>
</role_list>
<branch_list>
<branch value="all" include="no"></branch>
<branch value="/devAREA/" include="yes"></branch>
<branch value="/upgrade_test/AREA/include="yes"></branch>
<branch value="/dev4/AREA/" include="yes"></branch>
<branch value="/dev36/AREA/" include="yes"></branch>
<branch value="/dev05/" include="yes"></branch>
<branch value="/mandsmoney/AREA/" include="yes"></branch>
<branch value="/devAREA/" include="yes"></branch>
<branch value="/devAREA/" include="yes"></branch>
</branch_list>
</template_file>
<template_file ="Workflow" path="core/sanj"
<command_list>
<command value="new_job"></command>
<command include="no" value="all"></command>
</command_list>
<role_list>
<role allusers="yes" include="yes" value="editor"></role>
<role allusers="yes" include="yes" value="admin"></role>
<role allusers="yes" include="yes" value="master"></role>
<role include="no" value="all"></role>
</role_list>
<branch_list>
<branch value="all" include="no"></branch>
<branch value="/devAREA/" include="yes"></branch>
<branch value="/upgrade_test/AREA/include="yes"></branch>
<branch value="/dev4/AREA/" include="yes"></branch>
<branch value="/dev36/AREA/" include="yes"></branch>
<branch value="/dev05/" include="yes"></branch>
<branch value="/mandsmoney/AREA/" include="yes"></branch>
</branch_list>

</template_file>

<template_file ="township engagement" path="core/sanj/bills"
<command_list>
<command value="new_job"></command>
<command include="no" value="all"></command>
</command_list>
<role_list>
<role allusers="yes" include="yes" value="editor"></role>
<role allusers="yes" include="yes" value="admin"></role>
<role allusers="yes" include="yes" value="master"></role>
<role include="no" value="all"></role>
</role_list>
<branch_list>
<branch value="all" include="no"></branch>
<branch value="/devAREA/" include="yes"></branch>
<branch value="/upgrade_test/AREA/include="yes"></branch>
<branch value="/dev4/AREA/" include="yes"></branch>
<branch value="/dev36/AREA/" include="yes"></branch>
<branch value="/dev05/" include="yes"></branch>
<branch value="/mandsmoney/AREA/" include="yes"></branch>
<branch value="/devAREA/" include="yes"></branch>
</branch_list>

</template_file>

i mean to say the the number of lines in between <template_file name="Approve External" path="core/approve/bin"> and </template_file> is increasing,
the lines between <template_file ="township engagement" path="core/sanj/bills" and </template_file> is increasing
and also lines in between <template_file ="Workflow" path="core/sanj"> and </template_file> is also increasing.
The branch value is not fixed ,it can be be devAREA or upgrade_test dev4 ordev36 ordev05 or mandsmoney or anything as per requirment

Dear amincon007,
Thanks a lot for ur reply.

some portion of the file is given below.But the file format is same.

CTYPE available_templates SYSTEM './available_templates.dtd'>
<available_templates>
<template_file name="Approve External" path="core/approve/bin"
<command_list>
<command value="new_job"></command>
<command include="no" value="all"></command>
</command_list>
<role_list>
<role allusers="yes" include="yes" value="admin"></role>
<role allusers="yes" include="yes" value="master"></role>
<role allusers="yes" include="yes" value="editor"></role>
<role include="no" value="all"></role>
</role_list>
<branch_list>
<branch value="all" include="no"></branch>
<branch value="/devAREA/" include="yes"></branch>
<branch value="/upgrade_test/AREA/include="yes"></branch>
<branch value="/dev4/AREA/" include="yes"></branch>
<branch value="/dev36/AREA/" include="yes"></branch>
<branch value="/dev05/" include="yes"></branch>
<branch value="/mandsmoney/AREA/" include="yes"></branch>
<branch value="/devAREA/" include="yes"></branch>
<branch value="/devAREA/" include="yes"></branch>
</branch_list>
</template_file>
<template_file ="Workflow" path="core/sanj"
<command_list>
<command value="new_job"></command>
<command include="no" value="all"></command>
</command_list>
<role_list>
<role allusers="yes" include="yes" value="editor"></role>
<role allusers="yes" include="yes" value="admin"></role>
<role allusers="yes" include="yes" value="master"></role>
<role include="no" value="all"></role>
</role_list>
<branch_list>
<branch value="all" include="no"></branch>
<branch value="/devAREA/" include="yes"></branch>
<branch value="/upgrade_test/AREA/include="yes"></branch>
<branch value="/dev4/AREA/" include="yes"></branch>
<branch value="/dev36/AREA/" include="yes"></branch>
<branch value="/dev05/" include="yes"></branch>
<branch value="/mandsmoney/AREA/" include="yes"></branch>
</branch_list>
</template_file>
<template_file ="township engagement" path="core/sanj/bills"
<command_list>
<command value="new_job"></command>
<command include="no" value="all"></command>
</command_list>
<role_list>
<role allusers="yes" include="yes" value="editor"></role>
<role allusers="yes" include="yes" value="admin"></role>
<role allusers="yes" include="yes" value="master"></role>
<role include="no" value="all"></role>
</role_list>
<branch_list>
<branch value="all" include="no"></branch>
<branch value="/devAREA/" include="yes"></branch>
<branch value="/upgrade_test/AREA/include="yes"></branch>
<branch value="/dev4/AREA/" include="yes"></branch>
<branch value="/dev36/AREA/" include="yes"></branch>
<branch value="/dev05/" include="yes"></branch>
<branch value="/mandsmoney/AREA/" include="yes"></branch>
<branch value="/devAREA/" include="yes"></branch>
</branch_list>
</template_file>

i mean to say the the number of lines in between <template_file name="Approve External" path="core/approve/bin"> and </template_file> is increasing,
the lines between <template_file ="township engagement" path="core/sanj/bills" and </template_file> is increasing
and also lines in between <template_file ="Workflow" path="core/sanj"> and </template_file> is also increasing.
The branch value is not fixed ,it can be be devAREA or upgrade_test dev4 ordev36 ordev05 or mandsmoney or anything as per requirment

My aim is to check whether the string <branch value="/devarea/" include="yes"></branch> is present in
1)between <template_file name="Approve External" path="core/approve/bin"> and </template_file>
If it persent then how many times it is present in each case.
2)between <template_file ="Workflow" path="core/sanj"> and </template_file>
If it persent then how many times it is present in each case.
3)between <template_file ="township engagement" path="core/sanj/bills" and </template_file>
If it persent then how many times it is present in each case.

Please do reply how to write shellscript for this
If possible explain me the logic also