My project is on php. And i need to Create cXML file using XSL template.
I am very new to XSL and so far i have googled and creates a XSL template which outputs cXML, My code is below.
<?xml version="1.0" encoding="ISO-8859-1"?>
<files>
<file filename="Order_%Y%%m%%d%%h%%i%%s%.xml">
<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="xml" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="orders/order">
<xsl:variable name="created_at_timestamp" select="created_at_timestamp" />
<cXML lang="en-US" payloadID="{created_at_timestamp}" timestamp="">
<Header><From><Credential domain="NetworkID"><Identity>Enterprises</Identity></Credential></From>
<To><Credential domain="NetworkID"><Identity>xxx</Identity></Credential></To>
<Sender><Credential domain="NetworkID"><Identity>xxx Enterprises</Identity>
</Credential><UserAgent>Enterprises</UserAgent></Sender></Header>
</cXML>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
</file>
</files>
Now i need to know how to output the current timestamp in the cXML attribute timestamp, to be specific.
<cXML lang="en-US" payloadID="{created_at_timestamp}" timestamp="TIME_STAMP_HERE">
I tried many methods by googling, everything outputs only the plain text if i use it in "". For EX: if i use a function current-dateTime() it outputs like this.
<cXML lang="en-US" payloadID="{created_at_timestamp}" timestamp="current-dateTime()">
can anyone please help me to output the current timestamp inside my cXML attribute ? other parameters are working good.
EDIT
Expected output is <cXML lang="en-US" payloadID="xxx" timestamp="2014-11-07T12:00:13-04:00">
Thanks