У меня есть код ниже, который выбирает записи из соответствующего файла plmxml и отображает записи.Я показываю license_status 0 в качестве автора и 1 в качестве потребителя.Что я хочу, чтобы отсортировать license_status как автора и потребителя при отображении вывода?Я показываю это как HTML.Как я могу это сделать?
Заранее спасибо
<?xml version="1.0"?>
<!--
Filename: default_xml_template.xsl
Default xsl template file for XML report
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:plm="http://www.plmxml.org/Schemas/PLMXMLSchema">
<!-- Defining output as HTML -->
<xsl:output method="html" indent="yes"/>
<!-- Defining Global Variables
These are defined to avoid redundancy and use variables throughout the xsl document
-->
<xsl:variable name="trvrootref" select="/plm:PLMXML/plm:Header/@traverseRootRefs"/>
<xsl:variable name="roid" select="substring-after($trvrootref,'#')"/>
<xsl:variable name="roe" select="/plm:PLMXML/plm:ProductView/plm:Occurrence[@id=$roid]"/>
<xsl:variable name="rprid" select="substring-after($roe/@instancedRef,'#')"/>
<xsl:variable name="root" select="/plm:PLMXML/plm:ProductRevision[@id=$rprid]"/>
<!-- Reference to the Site element and last name attribute -->
<xsl:variable name="site" select="/plm:PLMXML/plm:Site"/>
<xsl:variable name="site_name" select="$site/@name"/>
<!-- The match attribute is used to associate a template with an XML element.
The match attribute can also be used to define a template for the entire XML document.
The value of the match attribute is an XPath expression (i.e. match="/" defines the whole document).
-->
<xsl:template match="/">
<!--
HTML to define the structure and presentation of the output report to be published
-->
<html>
<head>
<title>Global Teamcenter - Employee Information</title>
<!--
Calling the createCL template , passing parameter occStr as trvrootref variable
-->
<xsl:call-template name="createCL">
<xsl:with-param name="occStr" select="$trvrootref"/>
</xsl:call-template>
</table>
</div>
<br/>
</body>
</html>
</xsl:template>
<!-- Defining createCL template -->
<xsl:template name="createCL">
<xsl:param name="occStr"/>
<xsl:if test="$occStr!=''">
<xsl:choose>
<xsl:when test="contains($occStr,' ')">
<xsl:variable name="occid" select="substring-before($occStr,' ')"/>
<xsl:variable name="newid" select="substring-after($occid,'#')"/>
<xsl:call-template name="createCL">
<xsl:with-param name="occStr" select="$newid"/>
</xsl:call-template>
<xsl:call-template name="createCL">
<xsl:with-param name="occStr" select="substring-after($occStr,' ')"/>
</xsl:call-template>
</xsl:when>
<!-- inside createCL otherwise occStr <xsl:value-of select="$occStr"/> -->
<xsl:otherwise>
<xsl:choose>
<xsl:when test="contains($occStr,'#')">
<xsl:variable name="newid" select="substring-after($occStr,'#')"/>
<!--
Calling the creCLext template , passing parameter occid as newid variable
-->
<xsl:call-template name="creCLext">
<xsl:with-param name="occid" select="$newid"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!--
Calling the creCLext template , passing parameter occid as occStr variable
-->
<xsl:call-template name="creCLext">
<xsl:with-param name="occid" select="$occStr"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<!-- Defining creCLext template -->
<xsl:template name="creCLext">
<xsl:param name="occid"/>
<!-- Reference to the user element and user_id,status and license_level attribute -->
<xsl:variable name="user" select="/plm:PLMXML/plm:User[@id=$occid]"/>
<xsl:variable name="per_ref" select="substring-after($user/@personRef,'#')" />
<xsl:variable name="user_id" select="$user/@userId" />
<xsl:variable name="license_level" select="$user/plm:UserData/plm:UserValue[3]/@value"/>
<xsl:variable name="last_login_time" select="$user/plm:UserData/plm:UserValue[4]/@value"/>
<!-- Reference to the person element and last name attribute -->
<xsl:variable name="person" select="/plm:PLMXML/plm:Person[@id=$per_ref]"/>
<xsl:variable name="person_l" select="$person/@lastName"/>
<!-- Displaying the values by row order -->
<tr>
<td>
<xsl:value-of select="$person_l"/></td>
<td><xsl:value-of select="$user_id"/></td>
<td><xsl:choose>
<xsl:when test="$license_level=0">Author</xsl:when> <!-- Converting the output to string value -->
<xsl:otherwise>Consumer</xsl:otherwise>
</xsl:choose>
</td>
<td><xsl:value-of select="$last_login_time"/></td>
</tr>
</xsl:template>
</xsl:stylesheet>