How to automatically generate a file name for received files |
This example generates customer specific filenames for files received in the web service response. The example shows how to build a file path based upon information in the returned XML (1), how the user's home directory can be found from local properties (2) and how a formatted date can be retrieved (3). Using these items, a suitable file name can be made for the received file data. The transformation is as follows:
The sections of this transformation associated with retrieving items for the file name are described below:
<xsl:value-of select="local-name()"/>
xmlns:System="xalan://java.lang.System"
<xsl:value-of select="System:getProperty('user.home')"/>
xmlns:java="http://xml.apache.org/xalan/java"
<xsl:variable name="date" select="java:java.util.Date.new()"/>
<xsl:variable name="sdf" select="java:java.text.SimpleDateFormat.new('---yyyy-MM-dd---HH.mm.ss.SSS')"/>
<xsl:value-of select="java:format($sdf, $date)"/>
|