Breadcrumbs Folder Exclusion

scoccaro's Avatar

scoccaro

23 Jul, 2010 04:14 PM

I have my index page for each folder external from the pages subfolder, how can i exclude the pages folder from being indexed in my breadcrumbs?

  1. 1 Posted by Penny on 23 Jul, 2010 05:37 PM

    Penny's Avatar

    If I am understanding you correctly, it sounds like you are just trying to exclude the current folder.

    If that is the case, it depends on how much you have modified the XSLT provided but generally you will have select="descendant::system-folder[some more stuff]". You could just add the clause not(@current).

    So your statement should look something like select="descendant::system-folder[some stuff][not(@current)]".

  2. 2 Posted by scoccaro on 23 Jul, 2010 05:51 PM

    scoccaro's Avatar

    I appologize for being so vague. we have our index file in the folder then the other associated pages in a subfolder, so right now our breadcrumbs look like this:
    homepage>government>courts>clerk of courts>subfolder>alternative methods

    we want to eliminate "subfolder" thats what we are struggling with. I tried the snippet of code but it didnt seem to work.

  3. 3 Posted by Penny on 23 Jul, 2010 06:06 PM

    Penny's Avatar

    I am guessing your real intent is to not have folders output that do not have index pages.

    If your original XSLT statement looks like the following:
    <xsl:apply-templates select="descendant::system-folder[descendant::system-page[@current = 'true']][count(ancestor::system-folder) >= $skipLevels]"/>

    I would make it:
    <xsl:apply-templates select="descendant::system-folder[descendant::system-page[@current = 'true']][count(ancestor::system-folder) >= $skipLevels][system-page[name='index']]"/>

    If it is the case that you never want the folder that actually contains the page output, it should be:
    <xsl:apply-templates select="descendant::system-folder[descendant::system-page[@current = 'true']][count(ancestor::system-folder) >= $skipLevels][not(@current)]"/>

    If I have provided you with the original wrong select statement, can you please include that so that I have a better idea of what is going on.

    Thanks!

  4. 4 Posted by scoccaro on 23 Jul, 2010 06:12 PM

    scoccaro's Avatar

    Hey Penny,

    Nope i dont have anything that looks like that, here is what i have:

    <xsl:template match="/system-index-block">

        <ul>
            <xsl:if test="$wrapperID">
                <xsl:attribute name="id"><xsl:value-of select="$wrapperID"/></xsl:attribute>
            </xsl:if>
                <xsl:apply-templates select="descendant::system-folder[descendant::system-page [not(@current) = 'true']][count(::system-folder) >= $skipLevels]"/>
                <xsl:apply-templates select="//system-page[@current]"/>
        </ul>
    </xsl:template>
    
    <xsl:template match="system-">
        <li>
            <xsl:choose>
                <xsl:when test="system-page">
                    <a>
                        <xsl:attribute name="href">
                            <xsl:choose>
                                <xsl:when test="system-page[name = $defaultPage]"><xsl:value-of select="system-page[name = $defaultPage]/path"/></xsl:when>
                                <xsl:otherwise><xsl:value-of select="system-page[1]/path"/></xsl:otherwise>
                            </xsl:choose>
                        </xsl:attribute>
                        <xsl:call-template name="get-asset-name"/>
                    </a>
                </xsl:when>
                <xsl:otherwise><xsl:call-template name="get-asset-name"/></xsl:otherwise>
            </xsl:choose>
            <xsl:value-of select="$separator"/>
        </li>
    </xsl:template>
    
    <xsl:template match="system-page">
        <li><strong><xsl:call-template name="get-asset-name"/></strong></li>
    </xsl:template>
    
    <xsl:template name="get-asset-name">
        <xsl:choose>
            <xsl:when test="display-name"><xsl:value-of select="display-name"/></xsl:when>
            <xsl:when test="title"><xsl:value-of select="title"/></xsl:when>
            <xsl:otherwise><xsl:value-of select="concat('[[',name,']]')"/></xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    

    </xsl:stylesheet>

    Thanks for your help!!

  5. 5 Posted by Penny on 23 Jul, 2010 06:17 PM

    Penny's Avatar

    This:

        <xsl:if test="$wrapperID">
            <xsl:attribute name="id"><xsl:value-of select="$wrapperID"/></xsl:attribute>
        </xsl:if>
            <xsl:apply-templates select="descendant::system-folder[descendant::system-page [not(@current) = 'true']][count(::system-folder) >= $skipLevels]"/>
            <xsl:apply-templates select="//system-page[@current]"/>
    </ul>
    

    Should be:

        <xsl:if test="$wrapperID">
            <xsl:attribute name="id"><xsl:value-of select="$wrapperID"/></xsl:attribute>
        </xsl:if>
            <xsl:apply-templates select="descendant::system-folder[descendant::system-page [not(@current) = 'true']][count(::system-folder) >= $skipLevels][system-page[name='index']]"/>
            <xsl:apply-templates select="//system-page[@current]"/>
    </ul>
    
  6. 6 Posted by scoccaro on 23 Jul, 2010 06:23 PM

    scoccaro's Avatar

    I applied your changes, but i get this error: Invalid XSLT: A location path was expected, but the following token was encountered: ::

  7. 7 Posted by Penny on 23 Jul, 2010 06:32 PM

    Penny's Avatar

    I think this is being caused by a space that snuck into the xslt between system-page and [not(@current...

    Try the following:
    <ul>
    <xsl:if test="$wrapperID">
            <xsl:attribute name="id"><xsl:value-of select="$wrapperID"/></xsl:attribute>
        </xsl:if>
            <xsl:apply-templates select="descendant::system-folder[descendant::system-page[not(@current) = 'true']][count(::system-folder) >= $skipLevels][system-page[name='index']]"/>
            <xsl:apply-templates select="//system-page[@current]"/>
    </ul>

  8. 8 Posted by scoccaro on 23 Jul, 2010 06:42 PM

    scoccaro's Avatar

    isnt that weird? I am still getting the same error, it doesnt give me a line number either : Invalid XSLT: A location path was expected, but the following token was encountered: ::

  9. 9 Posted by Penny on 23 Jul, 2010 08:15 PM

    Penny's Avatar

    In addition to those changes, it appears you have <xsl: template match="system-"... "system-" should be "system-folder".

    I hope this helps.

  10. 10 Posted by scoccaro on 23 Jul, 2010 08:21 PM

    scoccaro's Avatar

    Hi Penny, I appreciate your help, but it still isnt working, I am still getting the same error. I have some ES hours that we should be using in the next week or so, I can ask for help then.

  11. Tim closed this discussion on 26 Jul, 2010 01:52 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac