Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Frankly, this looks about right to me - sometimes a simple substring is good enough.</p> <p>However, if you're in .NET land and you're really needing extra functionality .NET has <a href="http://www.15seconds.com/issue/031112.htm" rel="noreferrer">XSLT Extension Objects</a></p> <hr> <p>edit: oic, you've got a basic apply-templates conceptual problem. Try this (note the copy and the root template match):</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt; &lt;xsl:template match="*"&gt; &lt;xsl:copy&gt;&lt;xsl:apply-templates /&gt;&lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;xsl:template match="deliverydateasked"&gt; &lt;xsl:copy&gt; &lt;xsl:call-template name="FormatDate"&gt; &lt;xsl:with-param name="DateTime" select="."/&gt; &lt;/xsl:call-template&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;xsl:template name="FormatDate"&gt; &lt;xsl:param name="DateTime" /&gt; &lt;xsl:variable name="date"&gt; &lt;xsl:value-of select="substring-before($DateTime,'T')" /&gt; &lt;/xsl:variable&gt; &lt;xsl:if test="string-length($date) != 10"&gt; &lt;xsl:value-of select="$DateTime"/&gt; &lt;/xsl:if&gt; &lt;xsl:if test="string-length($date) = 10"&gt; &lt;xsl:value-of select="$date"/&gt; &lt;/xsl:if&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>templates is a hard concept to learn, you might be better off starting with the more straightforward <code>for-each</code>, and/or it seems you could do with some XSLT tutorials/books.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload