I need to add address from attribute studet in data element to the student attribut in the electronics element in the university tag, I need to add how many times I found the same name and number. same like subject names from data element to semister attribute in the electronics element in university tag. my output need to be like this.

I usually use XML::XSH2 for XML manipulation. In this case, I needed to wrap your input file into <xml>...</xml> and to add _ between subject and names to make it a valid XML. The output is also different to your expected output: spaces between attributes are not optional in XML.

When putting a smiley right before a closing parenthesis, do you:

Use two parentheses: (Like this: :) )
Use one parenthesis: (Like this: :)
Reverse direction of the smiley: (Like this: (: )
Use angle/square brackets instead of parentheses
Use C-style commenting to set the smiley off from the closing parenthesis
Make the smiley a dunce: (:>
I disapprove of emoticons
Other