I am trying to make a macro/xslt that has a 'date' and 'formatString' parameter as input parameters to emit a date string in any format I like according to the .NET format string syntax (e.g. "dd MMMM", ..).
The invocation of the macro looks as follows (e.g. for @createDate):
The problem I have is how to pass a umbraco 'date' attribute/property to the macro. E.g. what should I use as the parameter type for 'date'. It currently is set to 'text' which doesn't seem right to me.
With the above code nothing is returned in the XSLT because $date apparently is not holding the date that I had expected to be passed with the umbraco:item parameter. When I output $date in the XSLT file it shows the following:
Attempt to create a FormattedDateTime macro/xslt
I am trying to make a macro/xslt that has a 'date' and 'formatString' parameter as input parameters to emit a date string in any format I like according to the .NET format string syntax (e.g. "dd MMMM", ..).
The invocation of the macro looks as follows (e.g. for @createDate):
My XSLT looks as follows:
I think this is what you want
<umbraco:Macro Alias="FormattedDateTime"
date="[#createDate]"
format="dd MMMM"
runat="server" />
A parameter can be passed from your document using the [#property name] syntax. If you want to pass a recursive property use [$property name]
Cheers,
Richard
Thanks Richards. This indeed works. I didn't try this syntax because I thought it could only be used for 'data' aliases, not for node attributes.
is working on a reply...