Trying to use XSLT to modify partytemplate sizes

Users who are viewing this thread

So I'm making a modlist for Bannerlord and long story short, I want to make a bunch of optional manual partytemplate edits to various troop mods to make bandits/outlaw parties higher (the lazy way). I can easily just copy the original XMLs and do an overwrite but I'd like to try the XSLT approach.

There are a bunch of mods in question I want to make these for, but right now let's just use an example XML called "bandit_templates.xml" which inside has:

Code:
<?xml version="1.0" encoding="utf-8"?>
<partyTemplates>
  <MBPartyTemplate id="looters_template" >
    <stacks>
      <PartyTemplateStack min_value="3" max_value="30" troop="NPCCharacter.looter1" />
    </stacks>
  </MBPartyTemplate>
</partyTemplates>

I'm trying to use XSLT to replace / multiply the min and max values by 2 (eg min_value="6" & max_value="60"). So I followed the limited Bannerlord (at least for me) documentation on XSLT, used ChatGPT, my "bandit_templates.xslt" looks like:

Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="MBPartyTemplate[@id='looters_template']">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="PartyTemplateStack[@troop='NPCCharacter.looter1']">
    <PartyTemplateStack min_value="6" max_value="60" troop="NPCCharacter.looter1"/>
  </xsl:template>

</xsl:stylesheet>

Doesn't seem to work. I have the SubModule set up and all, I just.. don't think I grasp the XSLT part. Would appreciate it if someone could show me what's missing or wrong.
 
So I'm making a modlist for Bannerlord and long story short, I want to make a bunch of optional manual partytemplate edits to various troop mods to make bandits/outlaw parties higher (the lazy way). I can easily just copy the original XMLs and do an overwrite but I'd like to try the XSLT approach.

There are a bunch of mods in question I want to make these for, but right now let's just use an example XML called "bandit_templates.xml" which inside has:

Code:
<?xml version="1.0" encoding="utf-8"?>
<partyTemplates>
  <MBPartyTemplate id="looters_template" >
    <stacks>
      <PartyTemplateStack min_value="3" max_value="30" troop="NPCCharacter.looter1" />
    </stacks>
  </MBPartyTemplate>
</partyTemplates>

I'm trying to use XSLT to replace / multiply the min and max values by 2 (eg min_value="6" & max_value="60"). So I followed the limited Bannerlord (at least for me) documentation on XSLT, used ChatGPT, my "bandit_templates.xslt" looks like:

Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="MBPartyTemplate[@id='looters_template']">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="PartyTemplateStack[@troop='NPCCharacter.looter1']">
    <PartyTemplateStack min_value="6" max_value="60" troop="NPCCharacter.looter1"/>
  </xsl:template>

</xsl:stylesheet>

Doesn't seem to work. I have the SubModule set up and all, I just.. don't think I grasp the XSLT part. Would appreciate it if someone could show me what's missing or wrong.
 
Back
Top Bottom