I've read in a technical paper that using XSLT for making amendments in an XML file is a more efficient and preferable way than using the XML Parser like DOM, JDOM, SAX, JSoup etc. So I wanted to know on which parameters XSLT is more efficient and preferable to use than XML parser. (Does XSLT provide more generalized and easier solution?) Thanking you.
E.g.: If I've one XML file:
<node1>
<node2> TEXT </node2>
</node1>
and I need the output as:
<node1>
<node2> TEXT </node2>
<script src="xyz.js"></srcipt>
</node>
Then either I can write an XSLT for this to get the desired output or I can use XML-parser (DOM, SAX etc.) to write a Java program to insert the required element at the desired place and get the desired output. So for this I have read that XSLT is considered more preferable and effective.