I want to select all elements that have attribut 'categoryId' equal 'VGA-NVD'
and save them in new xml file.

As you see here, products have attribut 'categoryId' and I want to take all of the elements that have in this attribut value "VGA-NVD".
I'm able to print them in console using java script:
<script> src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js"></script>
<script src="https://requirejs.org/docs/release/2.3.5/minified/require.js"></script>
<script>
document.addEventListener('DOMContentLoaded', ()=>{
let url = "cennik.xml";
fetch(url)
.then(response=>response.text())
.then(data=>{
let parser = new DOMParser();
let xml = parser.parseFromString(data, "text/xml");
let images = xml.getElementsByTagName('Image');
let houses = xml.getElementsByTagName('Product');
let remove = xml.querySelector('Categories');
let remove2 = xml.querySelector('Producers');
remove2.remove();
for(let i=0; i<houses.length; i++){
var url2 = images[i].getAttribute('url')
images[i].setAttribute('url','https://cdn.action.pl/File.aspx?CID=77353&UID=newpoint&PID=9c4b2df98fb7b4c6ec77ef13d552fba6&P='+url2)
let houses_cat = houses[i].getAttribute('categoryId');
if(houses_cat=="VGA-NVD"){
}
}
console.log(xml)
});
})
</script>
I called all of the elements that their 'categoryId' is equal 'VGA-NVD'. Now how to save this response to xml file. If it isn't possible in java script, what should I do? Thank you for help.