Copied to clipboard

Flag this post as spam?

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


  • TaoistTotty 246 posts 314 karma points
    Jul 14, 2010 @ 19:06
    TaoistTotty
    0

    Ultimate Picker CheckBoxList

    I am at the moment trying to get the selected 'names' from the items selected for each sub-page of a node.

    Using the XSLT below I am able to get the node ID but do not seem to be able to get the name (i.e. I am seeing 1124 rather than soccer).

    What I am missing and where do I need to look (I have tried GetPreValueAsString, but this is throwing and XSLT error)?

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;">
                               <!ENTITY node "*[@isDoc]">
                               <!ENTITY hidden "*[@isDoc and umbracoNaviHide = 1]">
    ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>
        <xsl:variable name="itemsPerPage" select="/macro/itemsOnPage"/>
        <xsl:variable name="numberofItems" select="count($currentPage/&node;)"/>
        <xsl:variable name="pageNumber">
          <xsl:choose>
            <xsl:when test="umbraco.library:RequestQueryString('page') = ''">
              <xsl:value-of select="1"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="umbraco.library:RequestQueryString('page')"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
    <xsl:template match="/">
          <xsl:apply-templates select="$currentPage/&node;"/>
    </xsl:template>
    <xsl:template match="&node;">
       <div class="faqcontainer">
        <a href="#" class="faqquestion">Q- <xsl:value-of select="faqQuestion"/></a>
         <span class="faqanswer"><p>A- </p><xsl:value-of select="faqAnswer" disable-output-escaping="yes"/></span>
           <div class="sportsareas">
             <ul>
               <xsl:for-each select="faqSportsCovered">
                 <li>
                   <xsl:value-of select="current()"/>
                 </li>
               </xsl:for-each>
             </ul>
           </div>
      </div>
    </xsl:template>
        <xsl:template match="&node;[&hidden;]"/>
    </xsl:stylesheet>

    Thanking you in advance.

    TT

     

  • Bjorn Van Hoeymissen 27 posts 48 karma points
    Jul 14, 2010 @ 22:47
    Bjorn Van Hoeymissen
    0

    Hi TT,

    if memory serves well (it's been a long and tiring day) the GetPreValue functions are aimed at the datatypes that you manually add entries to (ie. dropdown, checkbox, dropdown multiple). The Ultimate Picker works differently.

    The value saved by the Ultimate Picker checkbox list is a comma seperated list of node IDs. Those node IDs are the ones you'll find underneath the parent node you've set up for your Ultimate Picker datatype. So basically you could filter the resultset of that particular parent node on the IDs that were checked and saved.

    Here's a rough idea of how I think you could go about it. Following code is not tested and just to give you an idea of the general outline.

    <xsl:variable name="sportsCollection" select="xpath to select your parent node used to populate Ultimate Picker"/>
    <xsl:variable name="checkedSports" select="umbraco.library:Split(ultimatePickerAlias, ',')" />
    <ul>
    <xsl:for-each select="checkedSports//value">
    <li>
    <xsl:value-of select="sportsCollection/node[@id=.]/@nodeName" />
    </li>
    </xsl:for-each>
    </ul>
  • TaoistTotty 246 posts 314 karma points
    Jul 21, 2010 @ 20:09
    TaoistTotty
    0

    Hi Bjorn

    Thank you for your reply.

    I do not know how, but this got posted twice.

    I finally used the answer here.

    http://our.umbraco.org/forum/developers/xslt/10690-Ultimate-Picker-CheckBoxList ;

    Many thanks.

    TT

Please Sign in or register to post replies

Write your reply to:

Draft