Jump to content

XSLT files to convert loot tables into node-centric XML (MS Access compatible)


Boidster

Recommended Posts

EDIT 9/3: Updated lootgroups.xsl to account for lootgroups which have a "count" attribute of 'all' or of the typical 'x,y' format.

 

I've been noodling around with loot.xml, blocks.xml, and entities.xml to build a database which can be used to answer questions about loot distribution. Becuase I haz it and because it has a built-in query/report/scripting system (and because I have some old skills with it), I chose MS Access as the tool. Access does not like 7D2D's XML for a few reasons, the most important of which is that the XML is attribute-centric instead of node-centric. So it's:

<lootgroup name="rareAutomotive">
    <item name="smallEngine"/>
    <item name="vehicleWheels"/>
</lootgroup>

Instead of:

<lootgroup>
  <name>rareAutomotive</name>
  <items>
    <item>smallEngine</item>
    <item>vehicleWheels</item>
  </items>
</lootgroup>

Frankly even the 2nd example, which is perfectly cromulent node-centric XML, won't import into Access very well. It needs to be flattened to the <item> level, with the parent attributes included on each <item>.

 

So in addition to my old Access skills I knocked some rust off of my limited XSLT skills and created a set of transformations that can be used during the Access XML import (the "Transform..." option) to produce the following tables:

 

lootcontainer

lootgroup

lootprobtemplate

qualitytemplate

 

Additionally I created transforms to pull out containers from blocks.xml and entityclasses.xml.

 

It opens the door to answering things like, "what is the probability at GS 100 of getting a T2 rare tool from any container that offers them?"

 

Anywho, this might be useful to nobody else in the world, but attached are the XSLT files if anybody else wants to play. For all I know this has already been solved in a much more elegant way, but it was fun to play around with!

 

 

7d2d_loot_XSLT.zip

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...