Я новичок в xslt и пытаюсь сгруппировать простой элемент xml и взять сумму, используя xslt 2.0. К сожалению, я не могу пройти oop через узел с группировкой. Нормально для каждого работает хорошо, но с группой ниже код не работает. Ниже мой код для xslt с html.
<?xml version = "1.0" encoding = "UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"/>
</head>
<body>
<h2 class="header" style="text-align:center;">Stock On Hand</h2>
<div class="container">
<table class="table table-bordered" style="border:2px solid black;">
<tr class="header-center"
style="color:black;text-align: center;background: #F1C40F;Font-size:15px;border:2px solid black;">
<th style="border:2px solid black;">Warehouse</th>
<th style="border:2px solid black;">Stock (Tons)</th>
</tr>
<xsl:for-each-group select="root/item" group-by="@State_Name">
<tr>
<td>
<xsl:value-of select="current-grouping-key()"/>
</td>
<td>
<xsl:value-of select="sum(current-group()/@Closing_Quantity)"/>
</td>
</tr>
</xsl:for-each-group>
</table>
</div>
</body>
</html>
</xsl:template></xsl:stylesheet>
А вот XML
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<item type="dict">
<Warehouse_Name type="str">Jammu & Kashmir</Warehouse_Name>
<State_Name type="str">Jammu & Kashmir</State_Name>
<City_Name type="str">Jammu</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Mouse</Category_Name>
<Closing_Quantity type="number">0.00</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Jammu & Kashmir</Warehouse_Name>
<State_Name type="str">Jammu & Kashmir</State_Name>
<City_Name type="str">Jammu</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Power Supplies</Category_Name>
<Closing_Quantity type="number">0.24</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Jammu & Kashmir</Warehouse_Name>
<State_Name type="str">Jammu & Kashmir</State_Name>
<City_Name type="str">Jammu</City_Name>
<Category_Code type="str">ITEW4</Category_Code>
<Category_Name type="str">Adapters / Chargers</Category_Name>
<Closing_Quantity type="number">1.22</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Jammu & Kashmir</Warehouse_Name>
<State_Name type="str">Jammu & Kashmir</State_Name>
<City_Name type="str">Jammu</City_Name>
<Category_Code type="str">ITEW4</Category_Code>
<Category_Name type="str">Adapters / Chargers</Category_Name>
<Closing_Quantity type="number">0.02</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Jammu & Kashmir</Warehouse_Name>
<State_Name type="str">Jammu & Kashmir</State_Name>
<City_Name type="str">Jammu</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">Cables</Category_Name>
<Closing_Quantity type="number">0.03</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Jammu & Kashmir</Warehouse_Name>
<State_Name type="str">Jammu & Kashmir</State_Name>
<City_Name type="str">Jammu</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">Cartridges</Category_Name>
<Closing_Quantity type="number">0.05</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Jammu & Kashmir</Warehouse_Name>
<State_Name type="str">Jammu & Kashmir</State_Name>
<City_Name type="str">Jammu</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">Printer (MFD)</Category_Name>
<Closing_Quantity type="number">0.16</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Jammu & Kashmir</Warehouse_Name>
<State_Name type="str">Jammu & Kashmir</State_Name>
<City_Name type="str">Jammu</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">Printers</Category_Name>
<Closing_Quantity type="number">0.77</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Jammu & Kashmir</Warehouse_Name>
<State_Name type="str">Jammu & Kashmir</State_Name>
<City_Name type="str">Jammu</City_Name>
<Category_Code type="str">ITEW7</Category_Code>
<Category_Name type="str">Copiers</Category_Name>
<Closing_Quantity type="number">0.11</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kolkatta</Warehouse_Name>
<State_Name type="str">West Bengal</State_Name>
<City_Name type="str">Kolkata</City_Name>
<Category_Code type="str">ITEW1</Category_Code>
<Category_Name type="str">Networking Cables</Category_Name>
<Closing_Quantity type="number">0.03</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kolkatta</Warehouse_Name>
<State_Name type="str">West Bengal</State_Name>
<City_Name type="str">Kolkata</City_Name>
<Category_Code type="str">ITEW1</Category_Code>
<Category_Name type="str">Servers</Category_Name>
<Closing_Quantity type="number">2.76</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kolkatta</Warehouse_Name>
<State_Name type="str">West Bengal</State_Name>
<City_Name type="str">Kolkata</City_Name>
<Category_Code type="str">ITEW15</Category_Code>
<Category_Name type="str">Batteries</Category_Name>
<Closing_Quantity type="number">0.01</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kolkatta</Warehouse_Name>
<State_Name type="str">West Bengal</State_Name>
<City_Name type="str">Kolkata</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Central Processing Unit (CPU)</Category_Name>
<Closing_Quantity type="number">2.38</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kolkatta</Warehouse_Name>
<State_Name type="str">West Bengal</State_Name>
<City_Name type="str">Kolkata</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">CRT Monitors</Category_Name>
<Closing_Quantity type="number">0.01</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kolkatta</Warehouse_Name>
<State_Name type="str">West Bengal</State_Name>
<City_Name type="str">Kolkata</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">Adapters / Chargers</Category_Name>
<Closing_Quantity type="number">0.04</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kolkatta</Warehouse_Name>
<State_Name type="str">West Bengal</State_Name>
<City_Name type="str">Kolkata</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">Printers</Category_Name>
<Closing_Quantity type="number">14.94</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kolkatta</Warehouse_Name>
<State_Name type="str">West Bengal</State_Name>
<City_Name type="str">Kolkata</City_Name>
<Category_Code type="str">ITEW7</Category_Code>
<Category_Name type="str">Cartridges</Category_Name>
<Closing_Quantity type="number">0.00</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kolkatta</Warehouse_Name>
<State_Name type="str">West Bengal</State_Name>
<City_Name type="str">Kolkata</City_Name>
<Category_Code type="str">ITEW7</Category_Code>
<Category_Name type="str">Copiers</Category_Name>
<Closing_Quantity type="number">0.01</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">CEEW1</Category_Code>
<Category_Name type="str">TV</Category_Name>
<Closing_Quantity type="number">0.00</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW1</Category_Code>
<Category_Name type="str">"kar'</Category_Name>
<Closing_Quantity type="number">0.12</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW1</Category_Code>
<Category_Name type="str">Routers</Category_Name>
<Closing_Quantity type="number">0.00</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW1</Category_Code>
<Category_Name type="str">Servers</Category_Name>
<Closing_Quantity type="number">0.63</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW1</Category_Code>
<Category_Name type="str">Switches</Category_Name>
<Closing_Quantity type="number">0.21</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW12</Category_Code>
<Category_Name type="str">Landline Phones</Category_Name>
<Closing_Quantity type="number">0.02</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW15</Category_Code>
<Category_Name type="str">Bluetooth Speaker</Category_Name>
<Closing_Quantity type="number">0.65</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW15</Category_Code>
<Category_Name type="str">Mixed Electronic Components of Mobile Phones</Category_Name>
<Closing_Quantity type="number">0.02</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW15</Category_Code>
<Category_Name type="str">Mobile Phones</Category_Name>
<Closing_Quantity type="number">0.00</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Cables</Category_Name>
<Closing_Quantity type="number">1.32</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Central Processing Unit (CPU)</Category_Name>
<Closing_Quantity type="number">10.32</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">CRT Monitors</Category_Name>
<Closing_Quantity type="number">1.31</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Hard Discs</Category_Name>
<Closing_Quantity type="number">0.00</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Keyboards</Category_Name>
<Closing_Quantity type="number">8.16</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">LCD/LED Monitors</Category_Name>
<Closing_Quantity type="number">4.91</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Mixed Components of Desktops</Category_Name>
<Closing_Quantity type="number">0.25</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Mother boards</Category_Name>
<Closing_Quantity type="number">0.02</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Mouse</Category_Name>
<Closing_Quantity type="number">0.56</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Power Supplies</Category_Name>
<Closing_Quantity type="number">2.61</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW3</Category_Code>
<Category_Name type="str">Adapters / Chargers</Category_Name>
<Closing_Quantity type="number">0.58</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW3</Category_Code>
<Category_Name type="str">Batteries</Category_Name>
<Closing_Quantity type="number">2.31</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW3</Category_Code>
<Category_Name type="str">Laptops/Notebooks</Category_Name>
<Closing_Quantity type="number">13.89</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW4</Category_Code>
<Category_Name type="str">Adapters / Chargers</Category_Name>
<Closing_Quantity type="number">0.02</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW5</Category_Code>
<Category_Name type="str">Notepads/Tablets</Category_Name>
<Closing_Quantity type="number">0.42</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">AC123</Category_Name>
<Closing_Quantity type="number">0.21</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">Adapters / Chargers</Category_Name>
<Closing_Quantity type="number">0.06</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">Printer (MFD)</Category_Name>
<Closing_Quantity type="number">1.70</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">Printers</Category_Name>
<Closing_Quantity type="number">10.69</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW7</Category_Code>
<Category_Name type="str">Cartridges</Category_Name>
<Closing_Quantity type="number">0.00</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Kurla</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Mumbai</City_Name>
<Category_Code type="str">ITEW7</Category_Code>
<Category_Name type="str">Copiers</Category_Name>
<Closing_Quantity type="number">0.18</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW15</Category_Code>
<Category_Name type="str">Batteries</Category_Name>
<Closing_Quantity type="number">0.01</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW15</Category_Code>
<Category_Name type="str">Mobile Phones</Category_Name>
<Closing_Quantity type="number">0.01</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">CD/DVD ROM</Category_Name>
<Closing_Quantity type="number">1.23</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Central Processing Unit (CPU)</Category_Name>
<Closing_Quantity type="number">0.16</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Keyboards</Category_Name>
<Closing_Quantity type="number">0.86</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">LCD/LED Monitors</Category_Name>
<Closing_Quantity type="number">0.82</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Mouse</Category_Name>
<Closing_Quantity type="number">0.06</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW3</Category_Code>
<Category_Name type="str">Batteries</Category_Name>
<Closing_Quantity type="number">1.21</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW3</Category_Code>
<Category_Name type="str">Laptops/Notebooks</Category_Name>
<Closing_Quantity type="number">0.01</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW4</Category_Code>
<Category_Name type="str">Adapters / Chargers</Category_Name>
<Closing_Quantity type="number">1.00</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW4</Category_Code>
<Category_Name type="str">Adapters / Chargers</Category_Name>
<Closing_Quantity type="number">0.14</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">Adapters / Chargers</Category_Name>
<Closing_Quantity type="number">0.01</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">Cartridges</Category_Name>
<Closing_Quantity type="number">0.02</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">Printer (MFD)</Category_Name>
<Closing_Quantity type="number">0.61</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">Printers</Category_Name>
<Closing_Quantity type="number">2.69</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Nagpur</Warehouse_Name>
<State_Name type="str">Maharashtra</State_Name>
<City_Name type="str">Nagpur</City_Name>
<Category_Code type="str">ITEW7</Category_Code>
<Category_Name type="str">Adapters /Chargers</Category_Name>
<Closing_Quantity type="number">0.01</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Near by pass argora</Warehouse_Name>
<State_Name type="str">Jharkhand</State_Name>
<City_Name type="str">Ranchi</City_Name>
<Category_Code type="str">ITEW1</Category_Code>
<Category_Name type="str">Servers</Category_Name>
<Closing_Quantity type="number">2.95</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Near by pass argora</Warehouse_Name>
<State_Name type="str">Jharkhand</State_Name>
<City_Name type="str">Ranchi</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Central Processing Unit (CPU)</Category_Name>
<Closing_Quantity type="number">0.01</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Near by pass argora</Warehouse_Name>
<State_Name type="str">Jharkhand</State_Name>
<City_Name type="str">Ranchi</City_Name>
<Category_Code type="str">ITEW2</Category_Code>
<Category_Name type="str">Keyboards</Category_Name>
<Closing_Quantity type="number">0.08</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Near by pass argora</Warehouse_Name>
<State_Name type="str">Jharkhand</State_Name>
<City_Name type="str">Ranchi</City_Name>
<Category_Code type="str">ITEW3</Category_Code>
<Category_Name type="str">Keypads</Category_Name>
<Closing_Quantity type="number">0.01</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Near by pass argora</Warehouse_Name>
<State_Name type="str">Jharkhand</State_Name>
<City_Name type="str">Ranchi</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">AC123</Category_Name>
<Closing_Quantity type="number">0.01</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Near by pass argora</Warehouse_Name>
<State_Name type="str">Jharkhand</State_Name>
<City_Name type="str">Ranchi</City_Name>
<Category_Code type="str">ITEW6</Category_Code>
<Category_Name type="str">Printers</Category_Name>
<Closing_Quantity type="number">0.86</Closing_Quantity>
</item>
<item type="dict">
<Warehouse_Name type="str">Near by pass argora</Warehouse_Name>
<State_Name type="str">Jharkhand</State_Name>
<City_Name type="str">Ranchi</City_Name>
<Category_Code type="str">ITEW7</Category_Code>
<Category_Name type="str">Copiers</Category_Name>
<Closing_Quantity type="number">0.01</Closing_Quantity>
</item>
Я использую библиотеку l xml для преобразования в моем проекте.
Вот код преобразования
import lxml.etree as ET
dom = ET.parse(xml_path)
xslt = ET.parse(xsl_path)
transform = ET.XSLT(xslt)
new_dom = transform(dom)
html = ET.tostring(new_dom, pretty_print=False)
Ниже приведен преобразованный результат
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"/>
</head>
<body>
<h2 class="header" style="text-align:center;">Stock On Hand</h2>
<div class="container">
<table class="table table-bordered" style="border:2px solid black;">
<tr class="header-center"
style="color:black;text-align: center;background: #F1C40F;Font-size:15px;border:2px solid black;">
<th style="border:2px solid black;">Warehouse</th>
<th style="border:2px solid black;">Stock (Tons)</th>
</tr>
</table>
</div>
</body>
</html>
Пожалуйста, помогите мне решить эту проблему. Курсор даже не заходит внутрь l oop.