I want to sort out the values of "number" by the Position/or first come in the XML document of the ID values and display it. Is there a way to do this.
Here is my XML document
<?xml version="1.0" encoding="UTF-8"?>
<JobList>
<Job ID="2" /> this is position 1
<Job ID="3" /> this is position 2
<Job ID="5" /> this is position 3
<Job ID="4" /> this is position 4
<Tool number="10" />
<Tool number="24" />
<Tool number="28" />
<Tool number="75" />
</JobList>
Desired Result:
<?xml version="1.0" encoding="UTF-8"?>
<JobList>
<Job ID="2" />
<Job ID="3" />
<Job ID="5" />
<Job ID="4" />
<Tool number="28" />
<Tool number="10" />
<Tool number="24" />
<Tool number="75" />
</JobList>
Here is my XSL document:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" encoding="UTF-8" method="xml" />
<xsl:param name="REPORT">joblist</xsl:param>
<xsl:param name="LOCALE">en-US</xsl:param>
<xsl:param name="FORMAT">html</xsl:param>
<xsl:param name="CAPTURE">example,job</xsl:param>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Joblist Report</title>
<style type="text/css">
body {font-family: Arial;}
</style>
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="JobList">
<div>
<table width="100" border="1">
<thead>
<tr>
<td>
<xsl:value-of select="Sorted Numbers" />
</td>
</tr>
</thead>
<tbody>
<xsl:variable name="vsortOrder" select="//Job[@ID]" />
<xsl:for-each select="Tool">
<xsl:sort select="@number" order="{$vsortOrder}" data-type="number" />
<tr>
<td>
<xsl:value-of select="@number" />
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</div>
</xsl:template>
</xsl:stylesheet>