mag*_*000 2 xml xslt datetime xsd date
尝试格式化文本以便在从XML拉到XSLT 1.0时显示为DD-MM-YYYY,因为我知道在使用xs:date时必须在XSD/XML中将其设置为YYYY-MM-DD,这就是我所拥有的用过的.
以下是我正在处理的代码,有关如何显示此代码的任何建议?
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<events xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="events.xsd">
  <venue id="01" 
         vtitle="ExCeL Exhibition Centre" 
         location="London" 
         telephone="0844 448 7600">
   <event name="Doctor Who 50th Celebration" date="2013-10-22">
    <image>images/doctor50.jpg</image><attribute>Doctor Who Event</attribute>
    <description>A 50th Anniversary musical bonanza for Doctor Who.</description>
    <ticket_price type="adult" status="available">£25.00</ticket_price>
    <ticket_price type="child" status="none">£11.00</ticket_price>
    <ticket_price type="junior" status="available">£0.00</ticket_price>
    <email>info@roundhouselondon.com</email>
</event>
</venue>
XSD
<xs:attribute name="date" type="xs:date"/>
XSLT
<xsl:element name="date"><xsl:value-of select="@date"/></xsl:element>
HTML
<date>2013-10-22</date>
另一种以dd/mm/yyyy形式生成日期的简单解决方案
<xsl:value-of select="
  concat(substring(@date, 9, 2), 
         '/', 
         substring(@date, 6, 2),
         '/', 
         substring(@date, 1, 4))"/>
| 归档时间: | 
 | 
| 查看次数: | 19193 次 | 
| 最近记录: |