Insert multiple nodes at different positions in the sequence/transform

Hello there, I’m writing a transform sequence that can insert multiple nodes in different positions simultaneously. I have a similar schema:

<!--Start Block Wrapper 1-->
<div class="wrapper">
    <div class="title">title1</div>
    <div class="conent">
        <p>content1</p>
        <p>content2</p>
        <!--Target pos 1-->
        <div class="wrapper">
            <div class="title">title2</div>
            <div class="conent">
                <p>content1</p>
                <p>content2</p>
                <!--Target pos 2-->
                <div class="wrapper">
                    <div class="title">title3</div>
                    <div class="conent">
                        <p>content1</p>
                        <p>content2</p>
                        <!--Target pos 3-->
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--End Block Wrapper 1-->

<!--Start Block Wrapper 2-->
<div class="wrapper">
    <div class="title">title4</div>
    <div class="conent">
        <p>content1</p>
        <p>content2</p>
        <div class="wrapper">
            <div class="title">title5</div>
            <div class="conent">
                <p>content1</p>
                <p>content2</p>
                <div class="wrapper">
                    <div class="title">title6</div>
                    <div class="conent">
                        <p>content1</p>
                        <p>content2</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--End Block Wrapper 2-->

As you follow the schema, I can break down Block wrapper 2 into three different individual nodes like this:

<!--Block 4-->
<div class="wrapper">
    <div class="title">title4</div>
    <div class="conent">
        <p>content1</p>
        <p>content2</p>
    </div>
</div>

<!--Block 5-->
<div class="wrapper">
    <div class="title">title5</div>
    <div class="conent">
        <p>content1</p>
        <p>content2</p>
    </div>
</div>

<!--Block 6-->
<div class="wrapper">
    <div class="title">title6</div>
    <div class="conent">
        <p>content1</p>
        <p>content2</p>
    </div>
</div>

Then I want to insert each of these three nodes into Block wrapper 1 in different positions and then remove Block wrapper 2 for good. (I have the position of every target)

For instance, I need to insert Block 4 in Pos 2 , Block 5 in Pos 1 and then Block 6 in Pos 3.

Therefore I’m asking how I can write a proper transform query to do this process. As we know, when a transform happens, the whole position we saved for this purpose will be invalid, and after each insert action, I need to retrieve a new position for the following insert action.

I would be appreciated it if you could point me to an example of a multiple transform query in advance.

You can map positions through the transform you’re building up (tr.mapping.map) to adjust them for the changes made so far.