Tech NovoGeek

...Technology Simplified

Tuesday, October 16, 2012

Removing bom ‘  ‘ from file c#

No comments :
UTF8Encoding utf8WithoutBom =  new UTF8Encoding(false); 
using (TextWriter writer = new StreamWriter(outputpath,false,utf8WithoutBom))
{
newDoc.Save(writer);
}

Thursday, October 11, 2012

How to display current Date and Time calling Templates in XSLT using C#

No comments :
The below script converts 'dd-mm-yyyy' to 'yyyymmdd' format.
<xsl:template name="formatDate">
<xsl:param name="dateTime" />
<xsl:variable name="dd" select="substring($dateTime,1,2)" />
<xsl:variable name="mm" select="substring($dateTime,4,2)" />
<xsl:variable name="yyyy" select="substring($dateTime,7,4)" />
<xsl:value-of select="concat($yyyy,$mm,$dd)" />
</xsl:template>


<xsl:call-template name="formatDate">
<xsl:with-param name="dateTime" select="TestDate" />
</xsl:call-template>