Copied to clipboard

Flag this post as spam?

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


  • Eric Warren 48 posts 68 karma points
    Jun 18, 2010 @ 15:22
    Eric Warren
    0

    Select nodeTypeAlias and check to see if property equals true

    I have been trying to figure out how to display a Events list only if a property equals true.  What i have is an Events list with a property of sports. I am trying to display the events if the nodeTypeAlias and the sports property is checked true.  Any thought

    Here is the code that i have currently

    <

     

    xsl:for-each select="$currentPage/ancestor-or-self::node//node [@nodeTypeAlias ='CWS_EventsList']/node">

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jun 18, 2010 @ 15:34
    Matt Brailsford
    0

    This should do the job

    <xsl:for-each select="$currentPage/ancestor-or-self::node//node [@nodeTypeAlias ='CWS_EventsList' and string(data[@alias='sports']) = '1']/node">

    Matt

  • Eric Warren 48 posts 68 karma points
    Jun 18, 2010 @ 15:48
    Eric Warren
    0

    Thanks for the responce Matt.  Here is what i have currently with you addition.  It seems to not display anything.  I checked and i do have some event with the sports checked.  Any other thoughts? 

    <ul class="events">
                <xsl:for-each select="$currentPage/ancestor-or-self::node//node [@nodeTypeAlias ='CWS_EventsList' and string(data[@alias='ListSportsEvent']) = '1']/node">
                                    <xsl:sort select="data [@alias = 'eventDate']" order="ascending"/>


                    <!-- Position() <= $noOfItems -->
                    <xsl:if test="position()&lt;= $noOfItems">
                        <li>
                           <span class="footerboxevents">
                                <em>
                                    <!-- Date Format: 15.12.08 -->
                                    <xsl:choose>
                                        <xsl:when test="@nodeTypeAlias = 'CWS_EventItem'">
                                            <xsl:value-of select="umbraco.library:FormatDateTime(data [@alias='eventDate'], 'dd.MM.yy')"/>
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:value-of select="umbraco.library:FormatDateTime(@createDate, 'dd.MM.yy')"/>
                                        </xsl:otherwise>
                                    </xsl:choose>
                                </em>

    <a href="{umbraco.library:NiceUrl(@id)}">
    <br/>
                                <span style="font-size:14px;" class="footerboxevents">
                                    <xsl:value-of select="@nodeName"/>
                                </span></a>
    </span>
                             <hr/>
                        </li>
                    </xsl:if>
                   
                </xsl:for-each>
            </ul>

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jun 18, 2010 @ 16:09
    Matt Brailsford
    0

    Hey Eric,

    I'd double check the docTypeAlias and propertyAlias names, as XSLT is case sensitive.

    Matt

  • Eric Warren 48 posts 68 karma points
    Jun 18, 2010 @ 16:22
    Eric Warren
    0

    I checked them and they they are correct.  Im not sure if this is the problem or not.  I have a document type set up for

    Events list ('CWS_EventsList) and Event Items (CWS_EventItem).  The event item has the propertyAlias of   (ListSportsEvent).  I think they way i have it is checking the Events list for the propertyAlias. Do i need to reference the Eventitem the check for the propertyAlias?  If so how

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jun 18, 2010 @ 16:35
    Matt Brailsford
    0

    Ahhh, ok, I think I missunderstood you question, give this a go:

    <xsl:for-each select="$currentPage/ancestor-or-self::node//node [@nodeTypeAlias ='CWS_EventsList']/node[string(data[@alias='ListSportsEvent']) = '1']">

    Matt

  • Eric Warren 48 posts 68 karma points
    Jun 18, 2010 @ 16:54
    Eric Warren
    0

    Thanks a ton.  That did the trick.  I new at Umbraco and XSLT.  So its going to take some time to learn all the stuff.  Thanks agian for all you help.

  • Eric Warren 48 posts 68 karma points
    Jun 18, 2010 @ 16:57
    Eric Warren
    0

    Thanks a ton.  That did the trick.  I new at Umbraco and XSLT.  So its going to take some time to learn all the stuff.  Thanks agian for all you help.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jun 18, 2010 @ 16:57
    Matt Brailsford
    0

    No problem, glad you got it working.

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft