# Need assistance adding or modifying an xml attribute with win\_xml

**URL:** <https://forum.ansible.com/t/need-assistance-adding-or-modifying-an-xml-attribute-with-win-xml/3762>\
**Category:** Get Help\
**Created:** [February 8, 2024, 4:16pm UTC](https://forum.ansible.com/t/need-assistance-adding-or-modifying-an-xml-attribute-with-win-xml/3762 "2024-02-08T16:16:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbarnes](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@mbarnes](https://forum.ansible.com/u/mbarnes)\
**Post date:** [February 8, 2024, 4:16pm UTC](https://forum.ansible.com/t/need-assistance-adding-or-modifying-an-xml-attribute-with-win-xml/3762/1 "2024-02-08T16:16:36Z")

</div>

I am running into an issue trying to add/modify an attribute using win\_xml. Trying to add a name to the host tag in the JBoss host.xml.

Example xml:

host xmlns=“urn:jboss:domain:20.0”

Playbook:

- name: Change host name on xml file secondary  
win\_xml:  
path: “{{ mwPath }}{{ theJBossFile.split(‘.0.zip’)[0] }}{{ secondaryXML }}”  
xpath: /\*[local-name() = ‘host’ and namespace-uri() = ‘urn:jboss:domain:20.0’]/  
attribute: ‘name’  
fragment: “{{ theHost }}-secondary1”  
type: attribute

Result:  
host xmlns=“urn:jboss:domain:20.0” d1p1:name=“BCDEVINTRAJB093-secondary1” xmlns:d1p1=“urn:jboss:domain:20.0”

All that I would like for my code to do is add the name attribute. So it should look like the following.  
host xmlns=“urn:jboss:domain:20.0” name=“BCDEVINTRAJB093-secondary1”

I dont understand why it is adding all of that other d1p1 stuff.
