Copied to clipboard

Flag this post as spam?

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

  • Bex 444 posts 555 karma points
    Jul 26, 2016 @ 09:01


    I am using an existing Umbraco 4.5.2 installation and have a really weird problem. I have a list of bulletins and bulletinCategories and some of them are in categories and some are not. I want to show the bulletins not in categories and the bulletin categories. I have them in an alphabetical list and I am using xsl Keys to display the A,B,C etc at the top of each section and to split them out.

    For some reason it's not showing the Ps!!

    This is my XSLT:

     <xsl:key name="bulletin-by-letter" match="*" use="concat(substring(@nodeName,1,1) ,sitecategory)"/>   
         <xsl:variable name="bulletins" select="$currentPage/ancestor-or-self::root//*[(not(parent::BulletinCategory) and
                        (self::BulletinCategory or self::Bulletin)
                      and category = $selectedCat)]" />
        <xsl:for-each select="$bulletins">
    <xsl:sort select="@nodeName" data-type="text" />
         <xsl:if test="count(. | key('bulletin-by-letter', concat(substring(@nodeName, 1, 1),sitecategory))[1]) = 1">
                 <h2 style="margin-top:15px;"><xsl:value-of select="concat(substring(@nodeName, 1, 1),sitecategory)" /></h2>  <-- this bit shows A or B or C etc
             <ul class="Bulletin">
                   <xsl:apply-templates select="key('bulletin-by-letter', concat(substring(@nodeName, 1, 1),sitecategory))" mode="item">

    $Bulletins definitely contains the nodes beginning with P.

    If I just do the

    <xsl:value-of select="concat(substring(@nodeName, 1, 1),sitecategory)"/> 

    it shows PCategoryName.

    but if I check it against the key like so:

       <xsl:if test="count(. | key('disease-by-letter', concat(substring(@nodeName, 1, 1),sitecategory))[1]) = 1">

    It comes back as false.

    Also if I change all my node name to start with a lower case p. It works fine.. or any other letter for that matter! It just seems to have a problem with P's!!

    I have no clue what is going on, and don't really understand XSLT enough to get any further!

    Can anyone help??

  • Bex 444 posts 555 karma points
    Jul 27, 2016 @ 15:44

    Anyone? Is there something weird about the key that doesn't like certain letters?

  • Bex 444 posts 555 karma points
    Aug 16, 2016 @ 13:30

    In case this helps any one in the future the problem was with my key.

    The key was set to match * so although my bulletins variable was filtering bulletins that didn't have a parent of "BulletinCategory" the key was matching everything so when it was checking if the match = 1 it was equalling 2.

    The reason this caused a problem with my P's was because some of my bulletinCategories had sub bulletins called things such as Part 1, Part 2 etc...

Please Sign in or register to post replies

Write your reply to: