Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tony Kiernan 278 posts 341 karma points
    Feb 15, 2011 @ 13:57
    Tony Kiernan
    0

    DateGreaterThanOrEqualToday in xslt select

    Is this not possible? Been trying something along the lines of the following

    $currentPage/* [($regionName = 'ALL' or $regionName = eventRegion)
    and umbraco.library:DateGreaterThanOrEqualToday(eventDate)
    and @isDoc and string(umbracoNaviHide) != '1']

    It throws up an error each time. I've managed to achieve what I want with various xsl:if, but that uses test. Wondering if there's an issue using library items in select clauses?

    Or am I, once more, just trying to do something completely wrong?

  • bob baty-barr 1180 posts 1294 karma points MVP
    Feb 16, 2011 @ 05:54
    bob baty-barr
    0

    what is the error you are getting?? i am using this as a select statement and it works just fine... not the exact library item... just because i was unaware of GreaterThanOrEqualToday - Doh!

    <xsl:for-each select="umbraco.library:GetXmlAll()//*
     [name() = $documentTypeAlias and string(umbracoNaviHide) != '1' and 
    umbraco.library:DateGreaterThan(start, $today)]">
  • Tony Kiernan 278 posts 341 karma points
    Feb 16, 2011 @ 10:07
    Tony Kiernan
    0

    Just the generic unable to render xslt error

  • Tony Kiernan 278 posts 341 karma points
    Feb 16, 2011 @ 10:15
    Tony Kiernan
    0

    Just the generic unable to render xslt error

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Feb 16, 2011 @ 10:16
    Chriztian Steinmeier
    0

    Hi Tony,

    This probably happens because one or two of the nodes you select has an empty (or non-existent) value in the property you send to the library function.

    Try to exclude the library call and inside the loop, do a simple value-of for the eventDate property along with @nodeName (or @id) and see if there's not one or two nodes getting caught in there with rogue data...

    /Chriztian 

  • Tony Kiernan 278 posts 341 karma points
    Feb 16, 2011 @ 10:20
    Tony Kiernan
    0

    Nah.  Two nodes with holding test data.  Both have values for that field

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Feb 16, 2011 @ 10:32
    Chriztian Steinmeier
    0

    Yeah - just came to another realization: You're doing all the filtering in the same predicate so effectively, the processor is calling the library function on everything else too - try putting that call in a separate predicate, like this:

    $currentPage/*[@isDoc]
    [not(umbracoNaviHide = 1)]
    [($regionName = 'ALL' or $regionName = eventRegion)]
    [umbraco.library:DateGreaterThanOrEqualToday(eventDate)]

    This way, it should only be called for "valid" nodes...

    /Chriztian

  • Tony Kiernan 278 posts 341 karma points
    Feb 16, 2011 @ 11:10
    Tony Kiernan
    0
    $currentPage/*[ @isDoc ]
    [not(umbracoNaviHide = '1')]
    [($regionName = 'ALL' or $regionName = eventRegion)]
    [umbraco.library:DateGreaterThanOrEqualToday(eventDate)]

    Same:

    Error parsing XSLT file: \xslt\Events.xslt

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Feb 16, 2011 @ 11:21
    Chriztian Steinmeier
    0

    OK - don't you get a "better"/more specific error description when you try to save the XSLT file in the Umbraco UI? - Usually you'd get a red box with the .NET error description.

    /Chriztian

  • Tony Kiernan 278 posts 341 karma points
    Feb 16, 2011 @ 11:27
    Tony Kiernan
    0

    D'oh.  I never really look at xslt in the Umbraco interface.  More fool me

    System.FormatException: String was not recognized as a valid DateTime.
    at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
    at umbraco.library.DateGreaterThanOrEqualToday(String firstDate)

    Edit: That said, why doesn't it mind it in the xsl:if?

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Feb 16, 2011 @ 11:41
    Chriztian Steinmeier
    0

    I only ever use it for the error messages :-)

    That error definitely tells me that it's calling the method on a property that doesn't exist (or is empty) - are you using it in a for-each select or a variable select?

    You could try to prepend the eventDate with current()/ (so current()/eventDate ) to see if it's somehow trying to use the eventDate of $currentPage...

    Otherwise - could you post some more of the XSLT here?

    /Chriztian

     

Please Sign in or register to post replies

Write your reply to:

Draft