I have been searching the forum for two days on this issue please can someone help? I have a field in my news document type called Article Date alias 'articleDate' I have written an xslt using formatdatetime but it returns nothing. The xslt is below and this is a link to the page that I used the macro in. I've tried a few variations i.e. taken current page out etc. Oh yes I'm using version 4.11
Thanks so much for your speady reply. I have replaced the code with the above but it's still retuning a blank. Is there a stage I've missed out or something? I also forgot to include the url in the post http://upgrade.c4eo.org.uk/news.aspx
FormatDateTime returning nothing
Hi All
I have been searching the forum for two days on this issue please can someone help? I have a field in my news document type called Article Date alias 'articleDate' I have written an xslt using formatdatetime but it returns nothing. The xslt is below and this is a link to the page that I used the macro in. I've tried a few variations i.e. taken current page out etc. Oh yes I'm using version 4.11
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:umbraco.library="urn:umbraco.library" exclude-result-prefixes="umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<!-- The fun starts here -->
<ul>
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:if test="position() <= 4">
<li class="news">
<h2><a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a> | <xsl:value-of select="umbraco.library:FormatDateTime($currentPage/data [@alias='articleDate'], 'dd.MM.yy')"/>
</h2>
<xsl:variable name="firstParagraph" select="umbraco.library:StripHtml(substring-before(bodyText, '</p'))"/>
<p><xsl:value-of select="$firstParagraph"/></p>
</li>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Hi Natasha,
The call is using the "Legacy Schema" syntax, which can, unfortunately be hard to detect if you're new to Umbraco.
The highlighted line should look like this instead:
Hope that helps - and don't hesitate to ask here - there are lots of friendly people who have had the same problems :-)
/Chriztian
Hi Chriztian
Thanks so much for your speady reply. I have replaced the code with the above but it's still retuning a blank. Is there a stage I've missed out or something? I also forgot to include the url in the post http://upgrade.c4eo.org.uk/news.aspx
Thanks again
Hi Natasha,
I glanced too quick - you're inside a for-each, so you actually just need to say articleDate and nothing else:
- you want the date of the current item in the iteration, not the $currentPage's articleDate every time ...
/Chriztian
Thank you so much you're a superstar
is working on a reply...