<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to increase or decrease the percentage of XML Attribute Values by regex?]]></title><description><![CDATA[<p dir="auto">For example:</p>
<pre><code>&lt;warrior&gt;
&lt;level agility="50" constitution="75" intelligence="100" strength="120"/&gt;
&lt;/warrior&gt;
</code></pre>
<pre><code>&lt;mage&gt;
&lt;level agility="75" constitution="50" intelligence="120" strength="100"/&gt;
&lt;/mage&gt;
</code></pre>
<p dir="auto">Now, I want to increase “agility” by 20%, “constitution” by 10%, “intelligence” by 20% and “strength” by 10% for “warrior” and do the opposite of “mage”.<br />
I wonder if there are any plugins or methods to do that? When both have about 160 lines.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/18746/how-to-increase-or-decrease-the-percentage-of-xml-attribute-values-by-regex</link><generator>RSS for Node</generator><lastBuildDate>Mon, 15 Jun 2026 18:07:50 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/18746.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 11 Jan 2020 08:27:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to increase or decrease the percentage of XML Attribute Values by regex? on Tue, 21 Jan 2020 09:18:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a></p>
<p dir="auto">Thank alot!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49983</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49983</guid><dc:creator><![CDATA[Tư Mã Tần Quảng]]></dc:creator><pubDate>Tue, 21 Jan 2020 09:18:39 GMT</pubDate></item><item><title><![CDATA[Reply to How to increase or decrease the percentage of XML Attribute Values by regex? on Sat, 11 Jan 2020 23:51:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/49810">How to increase or decrease the percentage of XML Attribute Values by regex?</a>:</p>
<blockquote>
<p dir="auto">this is a N++ forum after all</p>
</blockquote>
<p dir="auto">You are right, of course. But the XSLT solution provided above could also be used with the <em>XML Tools</em> plugin for Notepad++, thus it would stay in the N++ context. But this variant requires the user to enter the appropriate values for the input parameters into a small input box. That’s the reason why I suggested the <em>msxsl.exe</em> solution.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49812</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49812</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Sat, 11 Jan 2020 23:51:53 GMT</pubDate></item><item><title><![CDATA[Reply to How to increase or decrease the percentage of XML Attribute Values by regex? on Sat, 11 Jan 2020 17:18:03 GMT]]></title><description><![CDATA[<p dir="auto">For the record, the context of the original question was implied to be “within Notepad++” (this is a N++ forum after all).</p>
<p dir="auto">When I replied with “It’s a common question, to which the answer is probably not” that was of course within that context.</p>
<p dir="auto">If we were going to take it out of the N++ context, the answer is much broader, as <a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a> shows.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49810</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49810</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 11 Jan 2020 17:18:03 GMT</pubDate></item><item><title><![CDATA[Reply to How to increase or decrease the percentage of XML Attribute Values by regex? on Sat, 11 Jan 2020 15:37:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/t%C6%B0-m%C3%A3-t%E1%BA%A7n-qu%E1%BA%A3ng" aria-label="Profile: Tư-Mã-Tần-Quảng">@<bdi>Tư-Mã-Tần-Quảng</bdi></a></p>
<p dir="auto">This can be done with an XSL transformation. Please follow these steps:</p>
<ol>
<li>
<p dir="auto">Download <code>msxsl.exe</code>, a command line XSLT processor released by Microsoft, from <a href="https://www.microsoft.com/en-us/download/details.aspx?id=21714" rel="nofollow ugc">&gt;&gt;&gt; here &lt;&lt;&lt;</a>, or just google for <code>msxsl.exe</code>.</p>
</li>
<li>
<p dir="auto">Create a folder where to put:</p>
</li>
</ol>
<ul>
<li>your input XML file.</li>
<li>the XSL transformation file (see code below).</li>
<li>the batch script for automating the whole process (see code below).</li>
<li><code>*.ini</code> files for every user whose data you want to change in the XML file.</li>
</ul>
<pre><code class="language-Z"></code></pre>
<p dir="auto">Code of the XSL file (save it as e.g. <code>Transform.xsl</code>):</p>
<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;

&lt;xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;

  &lt;xsl:output
    method="xml"
    indent="yes"
    omit-xml-declaration="no"
    encoding="utf-8"
  /&gt;

  &lt;xsl:param name="userName"/&gt;
  &lt;xsl:param name="agilityFactor"/&gt;
  &lt;xsl:param name="constitutionFactor"/&gt;
  &lt;xsl:param name="intelligenceFactor"/&gt;
  &lt;xsl:param name="strengthFactor"/&gt;

  &lt;xsl:template match="@*|node()"&gt;
    &lt;xsl:copy&gt;
      &lt;xsl:apply-templates select="@*|node()"/&gt;
    &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template match="level"&gt;
    &lt;xsl:choose&gt;
      &lt;xsl:when test="name(..)=$userName"&gt;
        &lt;xsl:copy&gt;
          &lt;xsl:apply-templates select="@*"/&gt;

          &lt;xsl:attribute name="agility"&gt;
            &lt;xsl:value-of select="@agility * $agilityFactor"/&gt;
          &lt;/xsl:attribute&gt;

          &lt;xsl:attribute name="constitution"&gt;
            &lt;xsl:value-of select="@constitution * $constitutionFactor"/&gt;
          &lt;/xsl:attribute&gt;

          &lt;xsl:attribute name="intelligence"&gt;
            &lt;xsl:value-of select="@intelligence * $intelligenceFactor"/&gt;
          &lt;/xsl:attribute&gt;

          &lt;xsl:attribute name="strength"&gt;
            &lt;xsl:value-of select="@strength * $strengthFactor"/&gt;
          &lt;/xsl:attribute&gt;

          &lt;xsl:apply-templates select="node()"/&gt;
        &lt;/xsl:copy&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
        &lt;xsl:copy&gt;
          &lt;xsl:apply-templates select="@*|node()"/&gt;
        &lt;/xsl:copy&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;
  &lt;/xsl:template&gt;

&lt;/xsl:transform&gt;
</code></pre>
<pre><code class="language-Z"></code></pre>
<p dir="auto">Code of the batch script (save it as e.g. <code>Transform.cmd</code>). <strong>Please note</strong>: You have to customize lines 3 to 6 to your needs.</p>
<pre><code>@echo off &amp; setlocal

set "MSXSL=&lt;Path-To-msxsl.exe&gt;"
set "BaseDir=&lt;Path-To-Folder-With-Input-Files&gt;"
set "XMLFile=%BaseDir%\&lt;Name-Of-Your-XML-File&gt;"
set "XSLFile=%BaseDir%\&lt;Name-Of-Your-XSL-File&gt;"

copy "%XMLFile%" "%XMLFile%.bak"

for %%z in ("%BaseDir%\*.ini") do (
  for /f "usebackq tokens=1* delims==" %%a in ("%%~z") do (
    if /i "%%~a" equ "userName" set "UserName=%%~a='%%~b'"
    if /i "%%~a" equ "agilityFactor" set "NewAgility=%%~a=%%~b"
    if /i "%%~a" equ "constitutionFactor" set "NewConstitution=%%~a=%%~b"
    if /i "%%~a" equ "intelligenceFactor" set "NewIntelligence=%%~a=%%~b"
    if /i "%%~a" equ "strengthFactor" set "NewStrength=%%~a=%%~b"
  )

  call :ProcessUser
)

exit /b 0


:ProcessUser
  set "Params=%NewAgility% %NewConstitution% %NewIntelligence% %NewStrength%"
  "%MSXSL%" "%XMLFile%" "%XSLFile%" -o "%XMLFile%" %UserName% %Params%
exit /b 0
</code></pre>
<pre><code class="language-Z"></code></pre>
<p dir="auto">Now you can create <code>*.ini</code> files for every user whose data you want to change and store them in the folder you created before. Examples for the <code>*.ini</code> files based on your posting above:</p>
<p dir="auto"><code>warrior.ini</code></p>
<pre><code class="language-ini">userName=warrior
agilityFactor=1.2
constitutionFactor=1.1
intelligenceFactor=1.2
strengthFactor=1.1
</code></pre>
<p dir="auto"><code>mage.ini</code></p>
<pre><code class="language-ini">userName=mage
agilityFactor=0.8
constitutionFactor=0.9
intelligenceFactor=0.8
strengthFactor=0.9
</code></pre>
<pre><code class="language-Z"></code></pre>
<p dir="auto">Finally you can double-click the batch script file to do your changes. The script will create a backup of your original XML file with <code>.bak</code> appended to its file name in the same folder.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49807</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49807</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Sat, 11 Jan 2020 15:37:29 GMT</pubDate></item><item><title><![CDATA[Reply to How to increase or decrease the percentage of XML Attribute Values by regex? on Sat, 11 Jan 2020 13:20:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/t%C6%B0-m%C3%A3-t%E1%BA%A7n-qu%E1%BA%A3ng" aria-label="Profile: Tư-Mã-Tần-Quảng">@<bdi>Tư-Mã-Tần-Quảng</bdi></a></p>
<p dir="auto">It’s a common question, to which the answer is <em>probably not</em>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/49806</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/49806</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 11 Jan 2020 13:20:35 GMT</pubDate></item></channel></rss>