First off, Happy Holidays everyone! Ok so I have recently started a new project that requires me to work with a massive XML file, approximately 20k lines and is hard to work with because its not sorted and that has caused a lot of duplicate properties to appear in the nodes, I want to fix this. Using XSLT + Notepad++ should make this easy except I am having a difficult time finding information about XSLT sorting when you do not know every single property and its formatted like <property name="" />
.
What the file looks like:
<Items>
<item id="1">
<prop name="c">
<prop name="a">
<event name="c">
<event name="a">
<prop class="b">
<prop name="a">
<prop name="c">
</prop>
<prop class="a">
<prop name="b">
<prop name="a">
</prop>
</item>
</items>
What I would like the file to look like:
<Items>
<item id="1">
<prop name="a">
<prop name="b">
<event name="a">
<event name="c">
<prop class="a">
<prop name="a">
<prop name="c">
</prop>
<prop class="b">
<prop name="a">
<prop name="b">
</prop>
</item>
</items>
I just want to sort out the <prop name..>
by the value of the properties and then the same thing inside the <prop class>
-- Update -- Ok, so I didn't want post parts of the actual xml because its usually easy to swap the code out, however I been playing with this the last few hours and can't seem to get it working.
Here three different types of items from the XML.
<block id="1" name="stone">
<property name="Material" value="stone"/>
<property name="Shape" value="Terrain"/>
<property name="Mesh" value="terrain"/>
<property name="Texture" value="1"/>
<property name="Weight" value="100"/>
<property name="DropScale" value="2"/>
<property name="LPHardnessScale" value="2"/>
<drop event="Harvest" name="rockSmall" count="125"/>
<drop event="Harvest" name="ironFragment" count="5"/>
<drop event="Destroy" name="rockSmall" count="50"/>
<drop event="Fall" name="destroyedStone" count="1" prob="1.0" stick_chance=".75"/>
</block>
<block id="154" name="metalReinforcedWoodWedge60">
<property name="Material" value="metal"/>
<property name="Shape" value="Wedged60Full"/>
<property name="Texture" value="380"/>
<property name="Collide" value="movement,rocket,melee"/>
<property name="FuelValue" value="100"/>
<drop event="Destroy" name="woodDebris" count="1"/>
<property name="CanMobsSpawnOn" value="false"/>
<drop event="Fall" name="woodDebris" count="1" prob="1.0" stick_chance=".75"/>
<property class="UpgradeBlock">
<property name="ToBlock" value="scrapIronWedge60"/>
<property name="Item" value="scrapIron"/>
<property name="ItemCount" value="10"/>
<property name="UpgradeHitCount" value="4"/>
</property>
<property name="DowngradeBlock" value="reinforcedWoodWedge60"/>
<property class="RepairItems">
<property name="scrapIron" value="10"/>
</property>
<property name="Group" value="Building,Basics"/>
</block>
<block id="1146" name="cottonYoung">
<property name="Class" value="PlantGrowing"/>
<property name="Material" value="plants"/>
<property name="Shape" value="BillboardPlant"/>
<property name="Mesh" value="grass"/>
<property name="Texture" value="20"/>
<property name="Collide" value="melee"/>
<property name="CanDecorateOnSlopes" value="true"/>
<property name="IsTerrainDecoration" value="true"/>
<property class="PlantGrowing">
<property name="Next" value="cotton"/>
<property name="GrowthRate" value="60"/>
<property name="IsRandom" value="false"/>
<property name="FertileLevel" value="1"/>
</property>
</block>