Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Using the following to pull back a list of events sub pages
<xsl:for-each select="$currentPage/descendant::* [ @isDoc and string(umbracoNaviHide) != '1' and umbraco.library:DateGreaterThanOrEqualToday(umbraco.library:DateAdd(pageDate, 'd', eventDuration)) ]">
Is there any way to make the eventDuration have a default value of zero? Similar to in T-SQL
isNull(eventDuration, 0)
I'd rather not be running a check from inside the 'loop'
Your could write your own extension method for it, where you pass eventDuration and return 0 if the input is empty or null.
Can I take that as a 'No' in answer to my question?
Edit: That wasn't meant half as snippily as it sounds
Well, you could call the extension method in the for-each select, but you will indeed have to make it yourself.
It's a very small amount of work tho.
Just create a class with
public static string WithDefault (string input, string default) { return string.IsNullOrEmpty(input) ? default : input; }
Build and add dll in the bin folder.
Then add a line to xsltExteions.config. See:
http://en.wikibooks.org/wiki/Umbraco/Create_xslt_exstension_like_umbraco.Library_in_C
In the for-each loop, I'm adding a variable which I'm then testing assigning a value if
MY_VALUE = '' or MY_VALUE = NaN
Then using an if before each block of content
Is there really no way to do this check in the fore-each select?
Hi Tony,
I guess you could do something like this:
<xsl:decimal-format name="Nullify" infinity="0" NaN="0" /> <xsl:template match="/"> <xsl:for-each select="$currentPage/descendant::* [@isDoc] [not(umbracoNaviHide = 1)] [umbraco.library:DateGreaterThanOrEqualToday( umbraco.library:DateAdd(pageDate, 'd', format-number(eventDuration, '0', 'Nullify')) )]"> <!-- Do stuff --> </xsl:for-each> </xsl:template>
/Chriztian
Nice. I've now learnt something new.
Although, I've abandoned that approach as something in the next step made it easier for me to go back and change how I was doing stuff
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
An equivalent to isNull?
Using the following to pull back a list of events sub pages
Is there any way to make the eventDuration have a default value of zero? Similar to in T-SQL
I'd rather not be running a check from inside the 'loop'
Your could write your own extension method for it, where you pass eventDuration and return 0 if the input is empty or null.
Can I take that as a 'No' in answer to my question?
Edit: That wasn't meant half as snippily as it sounds
Well, you could call the extension method in the for-each select, but you will indeed have to make it yourself.
It's a very small amount of work tho.
Just create a class with
Build and add dll in the bin folder.
Then add a line to xsltExteions.config. See:
http://en.wikibooks.org/wiki/Umbraco/Create_xslt_exstension_like_umbraco.Library_in_C
In the for-each loop, I'm adding a variable which I'm then testing assigning a value if
Then using an if before each block of content
Is there really no way to do this check in the fore-each select?
Hi Tony,
I guess you could do something like this:
/Chriztian
Nice. I've now learnt something new.
Although, I've abandoned that approach as something in the next step made it easier for me to go back and change how I was doing stuff
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.