Modifying unselected branches in xslt
I want to modify a node in a branch depending on it's sibling. In the following example, I want to add `<var2 Value='D'/>` to the pre-existing `<nest2>` if `nest1` contains `<var1 Value='A'>`.

**Input:**

    <variables>
      <nest1>
        <var1 Value='A'/>
        <var1 Value='B'/>
      </nest1>
      <nest2>
        <var2 Value='C'/>
      </nest2>
    </variables>
**Output**

    <variables>
      <nest1>
        <var1 Value='A'/>
        <var1 Value='B'/>
      </nest1>
      <nest2>
        <var2 Value='C'/>
        <var2 Value='D'/>
      </nest2>
    </variables>

I can match `<var1 Value='A'/>`, but I don't know how to modify the pre-existing `<nest2>`. I can match `<nest2>`, but I don't know how to check to see if `<var1 Value='A'/>' exists in '<nest1>'. I'm just stumped on where to go from here.

I am using xslt 1.0.
Modifying unselected branches in xslt
===

I want to modify a node in a branch depending on it's sibling. In the following example, I want to add `<var2 Value='D'/>` to the pre-existing `<nest2>` if `nest1` contains `<var1 Value='A'>`.

**Input:**

    <variables>
      <nest1>
        <var1 Value='A'/>
        <var1 Value='B'/>
      </nest1>
      <nest2>
        <var2 Value='C'/>
      </nest2>
    </variables>
**Output**

    <variables>
      <nest1>
        <var1 Value='A'/>
        <var1 Value='B'/>
      </nest1>
      <nest2>
        <var2 Value='C'/>
        <var2 Value='D'/>
      </nest2>
    </variables>

I can match `<var1 Value='A'/>`, but I don't know how to modify the pre-existing `<nest2>`. I can match `<nest2>`, but I don't know how to check to see if `<var1 Value='A'/>' exists in '<nest1>'. I'm just stumped on where to go from here.

I am using xslt 1.0.