Skip to content

Anyone know XLST coding?

Featured Replies

Hi

 

Trying to dabble with some XLST code for a third party app at work, the current code displays completed repair jobs for a certain household in descending order (most recent first), I wish to restrict the list of jobs displayed to a maximum of 18 months prior to todays date.

 

The code is currently like this:

 

<tbody>
                  <xsl:for-each select="Root/RepairDetails/Location/Repairs[@job_status > '06']">
                              <xsl:sort select="@job_no" order="descending" data-type="text"/>
                  </xsl:for-each>
</tbody

 

The other field I hope to tap into for the date filter is @completed_date.  So no jobs will display when the completed date is over 18 months from todays date.

 

Many thanks

  • Administrators

HI

 

Not used it in ages, this might work in the select as it's a AND select: 

 [@job_status > '06'][@completed_date > $filter_date]

 

I've no idea how to get $filter_date to be a moving variable. I'd try that with a known fixed date first then work up from there.
HTH

I think that, unless you store a UNIX timestamp or number representation, you're going to have a hard time sorting dates. It's either going to do it alphabetically or numerically - and with a conventional date string that's not going to work?

  • Administrators

Aye, if the date is CCYYMMDD it should be ok on an alphanumeric sort if cast as a string. :fingerscrossed:

  • Author

Thanks guys will take a look. Normally coding in SQL do used to getdate() etc. to get a current stamp.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.