从xml中显示xslt中的当前日期数据

时间:2017-07-07 12:25:30

标签: xml xslt-1.0

我有一个XML



<Entity>
    <EntityTypeContent>
      <EntityTypeId>8074</EntityTypeId>
        <Content>
          <Xml>
            <IdValuePairs>
              <IdValuePair>
                <Id>Name</Id>
                <Value>Seminar1</Value>
              </IdValuePair>
              <IdValuePair>
                <Id>SeminarDate</Id>
                <Value>07/08/2017</Value>
              </IdValuePair>
              <IdValuePair>
                <Id>SeminarDateSortable</Id>
                <Value>20170705</Value>
              </IdValuePair>
              <IdValuePair>
                <Id>SeminarStartTime</Id>
                <Value>6:00 PM</Value>
              </IdValuePair>
              <IdValuePair>
                <Id>SeminarStartTimeSortable</Id>
                <Value>180000</Value>
              </IdValuePair>
              </IdValuePairs>
          </Xml>
        </Content>
    </EntityTypeContent>
    <EntityTypeContent>
      <EntityTypeId>8075</EntityTypeId>
        <Content>
          <Xml>
            <IdValuePairs>
              <IdValuePair>
                <Id>Name</Id>
                <Value>Seminar1</Value>
              </IdValuePair>
              <IdValuePair>
                <Id>SeminarDate</Id>
                <Value>07/09/2017</Value>
              </IdValuePair>
              <IdValuePair>
                <Id>SeminarDateSortable</Id>
                <Value>20170705</Value>
              </IdValuePair>
              <IdValuePair>
                <Id>SeminarStartTime</Id>
                <Value>6:00 PM</Value>
              </IdValuePair>
              <IdValuePair>
                <Id>SeminarStartTimeSortable</Id>
                <Value>180000</Value>
              </IdValuePair>
              </IdValuePairs>
          </Xml>
        </Content>
    </EntityTypeContent>
    <EntityTypeContent>
      <EntityTypeId>8076</EntityTypeId>
        <Content>
          <Xml>
            <IdValuePairs>
              <IdValuePair>
                <Id>Name</Id>
                <Value>Seminar1</Value>
              </IdValuePair>
              <IdValuePair>
                <Id>SeminarDate</Id>
                <Value>07/09/2017</Value>
              </IdValuePair>
              <IdValuePair>
                <Id>SeminarDateSortable</Id>
                <Value>20170705</Value>
              </IdValuePair>
              <IdValuePair>
                <Id>SeminarStartTime</Id>
                <Value>6:00 PM</Value>
              </IdValuePair>
              <IdValuePair>
                <Id>SeminarStartTimeSortable</Id>
                <Value>180000</Value>
              </IdValuePair>
              </IdValuePairs>
          </Xml>
        </Content>
    </EntityTypeContent>
</Entity>
&#13;
&#13;
&#13;

我有一个XSLT代码,可以使用上面的XML生成HTML

&#13;
&#13;
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="no" />
    <xsl:template match="/">
        <section id="page-attend-event">
            <div>
                <h2>Upcoming Seminars</h2>
                <xsl:for-each select="/Entity/EntityTypeContent">
                    <xsl:sort select="EntityTypeId/Content/Xml/IdValuePairs/IdValuePair[Id='SeminarDateSortable']/Value" data-type="number" />
                    <xsl:sort select="EntityTypeId/Content/Xml/IdValuePairs/IdValuePair[Id='SeminarStartTimeSortable']/Value" data-type="number" />
                    <div>
                        <h1>
                            <xsl:value-of select="EntityTypeId" />
                        </h1>
                        <div>
                            <xsl:value-of select="Content/Xml/IdValuePairs/IdValuePair[Id='SeminarDate']/Value" />
                        </div>
                    </div>
                </xsl:for-each>
            </div>
        </section>
    </xsl:template>
</xsl:stylesheet>
&#13;
&#13;
&#13;

此代码生成包含所有XML数据的HTML。

但我想显示其元素研讨会日期大于当前日期的XML数据

问题是我正在使用XSLT 1.0但是在这里如何添加当前日期的条件。我试图获得当前日期,但在XSLT 1.0中我们没有这个功能

请帮忙

0 个答案:

没有答案