Category Archives: Uncategorised

Mask FpML with xslt Identity Transform

This script will copy a FpML xml file and match and transform the fpml:tradeid to add the current date to the node value.

<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:fpml="http://www.fpml.org/2008/FpML-4-5"
xmlns:party="urn:party:data"
xmlns:kc="http://www.caulfieldfamily.co.uk">

<!--K Caulfield, Sep 2018
	Stylesheet to transform FpML XML messages into FpML XML messages with the trade id details prefixed to make then unique for repeated testing -->

	<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
	<xsl:strip-space elements="*"/>


<!-- define the prefix we want to use for setting up a text cycyle -->
<!--<xsl:variable name="trade_prefix" select="'20180925_01_'" />-->
<xsl:variable name="trade_prefix" select="concat(fn:format-date(fn:current-date(),'[Y0001][M01][D01]'),'_','01','_')" />
	
	
<!-- Identity Transform -->
<xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="//fpml:tradeHeader/fpml:partyTradeIdentifier/fpml:tradeId[../fpml:partyReference/@href='party1']/text()">
	<xsl:call-template name="kc:prefix"><xsl:with-param name="nodeVal" select="." /></xsl:call-template>
</xsl:template>

<xsl:template name="kc:prefix">
	<xsl:param name="nodeVal" />
		<xsl:value-of select="concat($trade_prefix,$nodeVal)" />
</xsl:template>

</xsl:stylesheet>

Transform a folder of XML files

If you ever need to bulk transform a directory of xml files, and output each transformed file into a new directory then Saxon has a great command line interface tool that will do just that, in one simple line!

CD C:\Users\caulfiek\Testing java -jar c:\Users\caulfiek\XSLT\saxonHE9-8-0-8j\saxon9he.jar -s:sourceDir\ -xsl:FPML_Masking.xslt -o:targetDir
Here I have  a stylesheet that performs an identity transform on a xml file, but uses xpath to find and mask certain xml node values (like customer name and transaction number).
Download the saxonHE9 cli tool from here:
https://sourceforge.net/projects/saxon/files/Saxon-HE/9.8/
Create a directory “sourceDir” and “targetDir”
Fill your “sourceDir” with lots of XML files and set up the command as above on your DOS command prompt.

 

Hello world! goodbye Joomla!

We’ll after many years on Joomla 1.7, I’ve had to give in as it’s a leaky as a leaky thing, and I’ve been hacked twice now.

Why anyone would want to do this is beyond my wonder really, it’s only a small blag with no importance and must be pretty easy to hack.

However I have learned something out of this:

  • htaccess is a nasty file and you need to keep it well protected.
  • put well difficult passwords on your ftp account and your MySQL account.
  • don’t use an “admin” user id for admin!
  • pick a CRM or Blog platform that you can keep up to date with latest version and take regular backups.

So with that in mind I’ve plunged for the latest version of WP and it seems much much easier to use than Joomla.

So get ready for lots of changes in Themes over the next few months until I get bored with them and probably stick to the first one that I’ve used! ha.

K