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 code is really straight forward

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

        xslTran.Transform(xmlDoc, Nothing, writer)




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

Batch Files - How can I replace a word after finding it?


I am using batch to create variables for another program (which I did not make). I need to modify these strings; but not replace the whole file (it is very long). However, when researching the topic,

iOS 9 not showing UIPageViewController full screen

ios objective-c iphone xcode7 uipageviewcontroller

I´m updating and app that it was built using iOS 8 and Xcode 6 to iOS 9 and Xcode 7. The app was working perfectly but now it is not showing my UIPageViewController at full screen in iPhone 6 and i...