Skip to content

Instantly share code, notes, and snippets.

@peterfleck
Created October 21, 2019 13:16
Show Gist options
  • Save peterfleck/b106c947e5b57ad07e091e180bee5800 to your computer and use it in GitHub Desktop.
Save peterfleck/b106c947e5b57ad07e091e180bee5800 to your computer and use it in GitHub Desktop.
HMRC Currency Exchange Rates
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date">
<xsl:output method="html" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />
<xsl:variable name="current-year">
<xsl:value-of select="substring(date:year(), 3, 2)" />
</xsl:variable>
<xsl:variable name="current-month">
<xsl:value-of select="date:month-in-year()" />
</xsl:variable>
<xsl:variable name="exchange-rates-url">
<xsl:value-of select="concat('http://www.hmrc.gov.uk/softwaredevelopers/rates/exrates-monthly-',$current-month,$current-year,'.xml')" />
</xsl:variable>
<xsl:variable name="hmrc-rates" select="document($exchange-rates-url)" />
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment