Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can someone help me finish this XSL document? I tried to do the other but it had

ID: 3824997 • Letter: C

Question

Can someone help me finish this XSL document? I tried to do the other but it had errors.Code and instructions below

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

youngston.xsl

<?xml version="1.0" encoding="UTF-8" ?>
<!--
New Perspectives on XML, 3rd Edition
  
Case Problem 2

Youngston Office Supply Style Sheet
Author: 4/21/17
Date:   

Filename: youngston.xsl
Supporting Files:
-->


<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="CustomerList" match="Order" use="CustomerID"/>


<xsl:template match="/">
<Customers>
  
</Customers>

</xsl:template>

</xsl:stylesheet>

6. Within the Customers element you just oreated, insert a for-each element that uses Muenchian grouping to loop through the unique values of the CustomerlD element within the Customerl ist key. Sort the for each loop by the values of the CustomerlD element. 7. Each time through the for-each loop, write the following code to the result document to provide information each oustomer.

Explanation / Answer

XML Code
-----------------
<?xml version="1.0" encoding="UTF-8"?>
<data>
   <CustomerList>
       <Customer CustomerID="2">
           <Summary>
               <TotalOrders>2</TotalOrders>
               <TotalCharges>300</TotalCharges>
           </Summary>
       </Customer>
       <Customer CustomerID="1">
           <Summary>
               <TotalOrders>1</TotalOrders>
               <TotalCharges>500</TotalCharges>
           </Summary>
       </Customer>
   </CustomerList>
   <OrderList>
       <Order OrderID="O1" OrderDate="2017/04/23" ShippedDate="2017/04/24">
           <SalesRep>S1</SalesRep>
           <Charge>100</Charge>
       </Order>
       <Order OrderID="O2" OrderDate="2017/04/23" ShippedDate="2017/04/24">
           <SalesRep>S2</SalesRep>
           <Charge>200</Charge>
       </Order>
       <Order OrderID="O3" OrderDate="2017/04/20" ShippedDate="2017/04/23">
           <SalesRep>S3</SalesRep>
           <Charge>500</Charge>
       </Order>
   </OrderList>
</data>


XSLT Code
youngston.xsl
-----------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="CustomerList" match="Order" use="CustomerID"/>
<xsl:key name="OrderList" match="Order" use="OrderID"/>
<xsl:template match="/">
<html>
<body>
   <h2>Customer List</h2>
   <table border="1">
       <tr bgcolor="#FF0000">
           <th>CustomerID</th>
           <th>TotalOrders</th>
           <th>TotalCharges</th>
       </tr>
       <xsl:for-each select="data/CustomerList/Customer">
           <xsl:sort select="@CustomerID" />
           <tr>
               <td><xsl:value-of select="@CustomerID"/></td>
               <xsl:for-each select="Summary">
                   <td><xsl:value-of select="TotalOrders"/></td>
                   <td><xsl:value-of select="TotalCharges"/></td>
               </xsl:for-each>
           </tr>
       </xsl:for-each>
   </table>

   <h2>Order List</h2>
   <table border="1">
       <tr bgcolor="#FF0000">
           <th>OrderID</th>
           <th>OrderDate</th>
           <th>ShippedDate</th>
           <th>SalesRep</th>
           <th>Charge</th>
       </tr>
       <xsl:for-each select="data/OrderList/Order">
           <tr>
               <td><xsl:value-of select="@OrderID"/></td>
               <td><xsl:value-of select="@OrderDate"/></td>
               <td><xsl:value-of select="@ShippedDate"/></td>
               <td><xsl:value-of select="SalesRep"/></td>
               <td><xsl:value-of select="Charge"/></td>
           </tr>
       </xsl:for-each>
   </table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Generated xml
youngston.xml
-------------------------
<html>
<body>
<h2>Customer List</h2>
<table border="1">
   <tr bgcolor="#FF0000">
       <th>CustomerID</th>
       <th>TotalOrders</th>
       <th>TotalCharges</th>
   </tr>
   <tr>
       <td>1</td>
       <td>1</td>
       <td>500</td>
   </tr>
   <tr>
       <td>2</td>
       <td>2</td>
       <td>300</td>
   </tr>
</table>
<h2>Order List</h2>
<table border="1">
   <tr bgcolor="#FF0000">
       <th>OrderID</th>
       <th>OrderDate</th>
       <th>ShippedDate</th>
       <th>SalesRep</th>
       <th>Charge</th>
   </tr>
   <tr>
       <td>O1</td>
       <td>2017/04/23</td>
       <td>2017/04/24</td>
       <td>S1</td>
       <td>100</td>
   </tr>
   <tr>
       <td>O2</td>
       <td>2017/04/23</td>
       <td>2017/04/24</td>
       <td>S2</td>
       <td>200</td>
   </tr>
   <tr>
       <td>O3</td>
       <td>2017/04/20</td>
       <td>2017/04/23</td>
       <td>S3</td>
       <td>500</td>
   </tr>
</table>
</body>
</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote