'XSLT - Refer HREF elements

I have a XML in the below format

<Envelope>
<Body>
<Ref id="ref1">
<user>Test1</user>
<company>Comp1</company>
<message href="#ref3" />
</Ref>
<Ref id="ref2">
<user>Test2</user>
<company>Comp2</company>
<message href="#ref4" />
</Ref>
<Ref id="ref3">Test message 1</Ref>
<Ref id ="ref4">Test message 2</Ref>
</Body>
</Envelope>

Using XLST I want to transform the above XML as below .I am totally new to XSLT, Can anyone please help me with this

Expected Output:

<Envelope>
<Body>
<Ref>
<user>Test1</user>
<company>Comp1</company>
<message>Test message 1</message>
</Ref>
<Ref>
<user>Test2</user>
<company>Comp2</company>
<message>Test message 1</message>
</Ref>
</Body>
</Envelope>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source