Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 349409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:27:20+00:00 2026-05-12T11:27:20+00:00

I have a question about XSLT. On a website i have a simple calendar,

  • 0

I have a question about XSLT.

On a website i have a simple calendar, showing events who are going on in the future.

But when an event is done, it should be removed from my list. By done i mean, that the date of the event is past the date of today.

Every event have a date attached.

Look at the folowing code:

<xsl:for-each select="$currentPage//node[@template='1238']">

    <xsl:sort data-type="text" select="./data[@alias='dato']" order="ascending"/>

    <div class="aktivitet_forside">
            ...MY EVENT CONTENT...                    
    </div>

</xsl:for-each>

The above code will show me all events with a template=’1238′ and that is also correct, because that is the template of my events.

But as I mentioned before every event have a field containing a date. The field is called “dato”. This is also the number I am sorting the events after, so the event with a date closest to today will be shown at the top of the list.

The format of the “dato”-field is: 2009-08-30T08:59:00

How do i automaticaly remove an event where the value of the “date”-field is past the date of today?

So if todays date is: 3th of september 2009, an event who has a date of 30th of august 2009 should not figure on the list.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:27:21+00:00Added an answer on May 12, 2026 at 11:27 am

    Assuming that you are using XSLT 1.0, If your XSLT processor supports the EXSLT extensions, you could make use of the date:difference function. There is also a plain XSLT template that is available which you can adapt to your scenario in case you do not have EXSLT natively available.

    http://www.exslt.org/date/functions/difference/index.html

    EDIT:

    There could be another simpler version where you convert your date-time-string to become a number having the format YYYYMMDDHHMMSS. This will be ordered in numerically ascending order automatically(future dates/times will have a bigger number than previous dates), you could then take the current day’s date-time string in the same way and do a regular numeric difference to see if the day is after or before the current date.

    <xsl:variable name="newFormat" select="translate('2009-08-30T08:59:00', '-T:', '')"/>
    
    Gives 20090830085900
    

    In your XPath, you can do this, assuming $currDateTime is set to the right translated value and the <data> node has the date to check, you could use the below..

    <xsl:for-each select="$currentPage//node[@template='1238'][data[@alias='dato' and ((number(translate(. ,'-T:', '')) - number($now)) &gt;=0)]]">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I saw a lot of examples of CopyStream implementation but I have question about
I'm working with xslt for the first time. I have 2.0, but that's about
I have a question about formatting the output of the sum() function in XQuery/XSLT/XPath.
I've got a question about copying some xml, with xslt. I have xml that
Another Newbie question in XSLT transformation. (I have asked similar question before, but in
I have question about parsing in Html helper : I have sth like: @foreach
I have question about clean thory in Python. When: @decorator_func def func(bla, alba): pass
I have question about XSLT1.0. The task is to write out in HTML all
I have question about normalization. Suppose I have an applications dealing with songs. First
I have question about interpreting strings as packed binary data in C++. In python,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.