views:

322

answers:

2

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!

A: 

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))"/>
Robert Rossney
A: 

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',' ')"/>
Tim C