Modifying xml with javascript in xsl

Hi all,

I’m new here and I’m trying to find out if it is possible to modify an xml file with javascript in an xsl.
for example if this is in my xml file:

<LIBRARY>
<BOOK>
<TITLE>aaa</TITLE>
</BOOK>
<BOOK>
<TITLE>bbb</TITLE>
</BOOK>
</LIBRARY>

and this in my xsl

<xsl:for-each select=“LIBRARY/BOOK”>
<xsl:sort select=“TITLE”/>
Title : <xsl:value-of select=“TITLE”/><br/>
</xsl:for-each>

I want to be able to change a title and have the xsl change the order accordingly and it just need this to be done client-side.
Is this possible or is there a better way to do this?