removing the “T” from a datetime when doing a xml+xsl=html with .net (XmlDataDocument,XslCompiledTransform,XmlTextWriter)

what is the easiest way to remove the "T" from the result?

I want the result to be "YYYY/MM/DD HH/MM/SS"

the vb.net code is really straight forward

        xmlDoc = New Xml.XmlDataDocument(data_set)
        xslTran = New Xml.Xsl.XslCompiledTransform
        xslTran.Load(strXslFile)
        writer = New Xml.XmlTextWriter(strHtmlFile, System.Text.Encoding.UTF8)

        xslTran.Transform(xmlDoc, Nothing, writer)

        writer.Close()

thanks!

Answers


You could also use the substring-before and substring-after functions in your XSLT file.

<xsl:value-of select="substring-before(@datetime, 'T')" />
<xsl:text> </xsl:text>
<xsl:value-of select="substring-after(@datetime, 'T')"/>

Alternatively, you could make use of the translate function, to replace a T with a space.

<xsl:value-of select="translate(@datetime,'T',' ')"/>

This is a more readable way of doing it:

<xsl:value-of select="substring(., 1, 10)"/>
<xsl:text> </xsl:text>
<xsl:value-of select="substring(., 12, 8)"/>

This is less readable but more concise:

<xsl:value-of select="concat(substring(., 1, 10), ' ', substring(., 12, 8))"/>

Need Your Help

ROS - Compilation fails due to Bzip2 libraries

compilation make libraries ros bzip2

I'm trying to compile a package using Ros Indigo. I'm using a Raspberry Pi running Raspbian. The BZIP2_LIBRARIES BZIP2_INCLUDE_DIR are missing. When I run the make command, I get the following erro...

AS3 change stage size - virtual camera

actionscript-3 camera stage gamecanvas

Edit: Is there any way to adjust the stage size and position from inside flash?