I have a file example.txt with the following content:

Begin of file

BEGIN
1
2
3
4
5
6
7
8
9
10
END

End of file

I want to replace every second line inside a matched space of sed. So I tired

cat example.txt | sed -E "/BEGIN/,/END/{3~2s/./X/g}"

unfortunately it outputs only

Begin of file

XXXXX
1
X
3
X
5
X
7
X
9
XX
END

End of file

So the 3 means the third line of my text file and the 2 means every second line.

But I want to replace every second line between my two patterns BEGIN and END.
How can I make sed realize that 3~2s doesn't mean the files line numbers but the number of lines inside the matched space?

So my goal is

Begin of file

BEGIN
1
X
3
X
5
X
7
X
9
XX
END

End of file

But not from the beginning of the file, but from the start of the matched block? So 5~2s would be a non possible cheat to achieve this.