-- 作者:ckearth
-- 发布时间:11/16/2005 1:45:00 PM
-- 请教:以下XML文件中如何设定时间
请教:以下XML文件中如何设定时间 <valid-from></valid-from> <valid-to></valid-to> <maintenance-to></maintenance-to> <?xml version="1.0" encoding="utf-8" standalone="yes"?> <!-- edited with XMLSpy v2006 sp1 U (http://www.altova.com) by () --> <!-- Use a standards compliant web browser to view this file--> <!-- This is a working license--> <?xml-stylesheet type="text/xsl" href="D:\Mastercam HSM Performance Pack\stylesheets\license.xsl"?> <license xmlns="http://www.cimco-software.com/xml/2003/license/1.0"> <product>Mastercam HSM Performance Pack Release 1</product> <company>ckearth</company> <department>robot</department> <email>ckearth@126.com</email> <domain>robot</domain> <address>outangwuxi</address> <reseller>cimco</reseller> <issued-by>cimco</issued-by> <valid-from></valid-from> <valid-to></valid-to> <maintenance-to></maintenance-to> <constraints> <dongle name="1" type="industrial"/> </constraints> <components> <component name="Mastercam HSM Performance Pack Release 1" number="1"/> </components> </license> 才能用XSL文件看到时间 <?xml version="1.0" encoding="utf-8" standalone="yes"?> <!-- Copyright (c) 2003, 2004 by CIMCO Integration http://www.cimco-software.com All rights reserved $Revision: $ $Date: $ --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:license="http://www.cimco-software.com/xml/2003/license/1.0"> <xsl:output method="html" encoding="utf-8"/> <xsl:template match="/"> <html> <xsl:apply-templates select="license:license"/> </html> </xsl:template> <xsl:template match="license:license"> <head> <title><xsl:text>License for </xsl:text><xsl:value-of select="@product"/></title> </head> <body> <h2>Licensee Information</h2> <xsl:apply-templates select="license:company"/> <xsl:apply-templates select="license:department"/> <xsl:apply-templates select="license:email"/> <xsl:apply-templates select="license:domain"/> <xsl:apply-templates select="license:address"/> <xsl:apply-templates select="license:reseller"/> <h2>Issue Information</h2> <xsl:apply-templates select="license:issued-by"/> <xsl:apply-templates select="license:valid-from"/> <xsl:apply-templates select="license:valid-to"/> <xsl:apply-templates select="license:maintenance-to"/> <xsl:apply-templates select="license:constraints"/> <xsl:apply-templates select="license:components"/> </body> </xsl:template> <xsl:template match="license:constraints"> <h2>Constraints</h2> <p><xsl:text>The license has been issued for use under the following constraints.</xsl:text></p> <h3><xsl:text>The following security devices are activated by the license</xsl:text></h3> <xsl:if test="count(license:dongle)!=0"> <ul> <xsl:apply-templates select="license:dongle"> <xsl:sort data-type="number" select="@name"/> </xsl:apply-templates> </ul> </xsl:if> <xsl:if test="count(license:dongle)=0"> <p><xsl:text>No dongles.</xsl:text></p> </xsl:if> </xsl:template> <xsl:template match="license:components"> <h2><xsl:text>Components</xsl:text></h2> <p><xsl:text>The following components of the product are activated.</xsl:text></p> <xsl:if test="count(license:component[@name='CIMCO License Manager'])>0"> <p>This is a floating license for use with CIMCO License Manager.</p> </xsl:if> <ul> <xsl:apply-templates select="license:component"/> </ul> </xsl:template> <xsl:template name="dongle"> <xsl:param name="name" select="''"/> <xsl:param name="type" select="''"/> <xsl:param name="network" select="''"/> <xsl:param name="licenses" select="''"/> <xsl:variable name="type-text"> <xsl:choose> <xsl:when test="$type='dealer'"> <xsl:text>Mastercam dealer HASP</xsl:text> </xsl:when> <xsl:when test="$type='educational'"> <xsl:text>Mastercam educational HASP</xsl:text> </xsl:when> <xsl:when test="$type='industrial'"> <xsl:text>Mastercam industrial HASP</xsl:text> </xsl:when> <xsl:when test="$type='hsm'"> <xsl:text>HSM HASP</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>invalid</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:variable> <li> <xsl:choose> <xsl:when test="$network='yes'"> <b><xsl:value-of select="$name"/></b><xsl:text> (</xsl:text><xsl:value-of select="$type-text"/><xsl:text> - network with </xsl:text><xsl:value-of select="$licenses"/> level 3 milling licenses<xsl:text>). See activated floating licenses below.</xsl:text> </xsl:when> <xsl:otherwise> <b><xsl:value-of select="$name"/></b><xsl:text> (</xsl:text><xsl:value-of select="$type-text"/><xsl:text>)</xsl:text> </xsl:otherwise> </xsl:choose> </li> </xsl:template> <xsl:template match="license:dongle"> <xsl:call-template name="dongle"> <xsl:with-param name="name" select="@name"/> <xsl:with-param name="type" select="@type"/> <xsl:with-param name="network" select="@network"/> <xsl:with-param name="licenses" select="@licenses"/> </xsl:call-template> </xsl:template> <xsl:template match="license:issued-by"> <p><b><xsl:text>Issued by: </xsl:text></b><xsl:value-of select="."/></p> </xsl:template> <xsl:template match="license:valid-from"> <p><b><xsl:text>Valid from: </xsl:text></b><xsl:value-of select="@day"/><xsl:text>. </xsl:text><xsl:call-template name="get-month-name"><xsl:with-param name="index" select="@month"/></xsl:call-template><xsl:text> </xsl:text><xsl:value-of select="@year"/></p> </xsl:template> <xsl:template match="license:valid-to"> <xsl:choose> <xsl:when test="@day=1 and @month=1 and @year=3000"> <p><b><xsl:text>Valid to:</xsl:text></b><xsl:text> never expires</xsl:text></p> </xsl:when> <xsl:otherwise> <p><b><xsl:text>Valid to: </xsl:text></b><xsl:value-of select="@day"/><xsl:text>. </xsl:text><xsl:call-template name="get-month-name"><xsl:with-param name="index" select="@month"/></xsl:call-template><xsl:text> </xsl:text><xsl:value-of select="@year"/></p> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="license:maintenance-to"> <p><b><xsl:text>Maintenance to: </xsl:text></b><xsl:value-of select="@day"/><xsl:text>. </xsl:text><xsl:call-template name="get-month-name"><xsl:with-param name="index" select="@month"/></xsl:call-template><xsl:text> </xsl:text><xsl:value-of select="@year"/></p> </xsl:template> <xsl:template match="license:company"> <p><b><xsl:text>Company: </xsl:text></b><xsl:value-of select="."/></p> </xsl:template> <xsl:template match="license:department"> <p><b><xsl:text>Department: </xsl:text></b><xsl:value-of select="."/></p> </xsl:template> <xsl:template match="license:email"> <p><b><xsl:text>E-mail: </xsl:text></b><xsl:value-of select="."/></p> </xsl:template> <xsl:template match="license:domain"> <p><b><xsl:text>Domain: </xsl:text></b><xsl:value-of select="."/></p> </xsl:template> <xsl:template match="license:address"> <p><b><xsl:text>Address:</xsl:text></b></p> <pre><xsl:value-of select="."/></pre> </xsl:template> <xsl:template match="license:reseller"> <h2>Support Information</h2> <pre><xsl:value-of select="."/></pre> </xsl:template> <xsl:template name="get-month-name"> <xsl:param name="index"/> <xsl:choose> <xsl:when test="$index=1"> <xsl:text>January</xsl:text> </xsl:when> <xsl:when test="$index=2"> <xsl:text>February</xsl:text> </xsl:when> <xsl:when test="$index=3"> <xsl:text>March</xsl:text> </xsl:when> <xsl:when test="$index=4"> <xsl:text>April</xsl:text> </xsl:when> <xsl:when test="$index=5"> <xsl:text>May</xsl:text> </xsl:when> <xsl:when test="$index=6"> <xsl:text>June</xsl:text> </xsl:when> <xsl:when test="$index=7"> <xsl:text>July</xsl:text> </xsl:when> <xsl:when test="$index=8"> <xsl:text>August</xsl:text> </xsl:when> <xsl:when test="$index=9"> <xsl:text>September</xsl:text> </xsl:when> <xsl:when test="$index=10"> <xsl:text>October</xsl:text> </xsl:when> <xsl:when test="$index=11"> <xsl:text>November</xsl:text> </xsl:when> <xsl:when test="$index=12"> <xsl:text>December</xsl:text> </xsl:when> <xsl:otherwise> <xsl:value-of select="$index"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="license:component"> <xsl:variable name="floating" select="count(//license:component[@name='CIMCO License Manager'])>0"/> <li> <b><xsl:value-of select="@name"/></b> <xsl:variable name="count"> <xsl:choose> <xsl:when test="@number"> <xsl:value-of select="@number"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="1"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:if test="$floating"> <xsl:text> (</xsl:text> <b><xsl:value-of select="$count"/></b> <xsl:text> </xsl:text> <xsl:choose> <xsl:when test="$count=1"> <xsl:text>floating license</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>floating licenses</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text>)</xsl:text> </xsl:if> </li> </xsl:template> </xsl:stylesheet>
|