Developer forum

Forum » Templates » XSLT breadcrumb question

XSLT breadcrumb question

Dmitrij Jazel
Reply

Hello DW Guys,

 

I actually wanted to know how can I use the possibility of choosing "hide in menu" "Skjul i menu" "Medtag i menu" and "View in breadcrumb path" "Vis i brødkrumme sti" what exactly has to be checked?

 

For now I have a page, that I don't want to be seen in menu, but I want it to be seen in Breadcrumb.

It has "hide in menu" and "View in breadcrump bath" on.

"Medtag i menu" is off.

 

But I still can't see it in both menu, and breadcrumb - and I want it to be seen only in breadcrumb.

 

I know it is XSLT thing, I just have to add "choose" or "test" statement to check whether the value can or cannot be checked.

I just want to know the condition statement that can correspond to this... Or maybe I have to do it in different way?

 

Kind regards,

Dmitrij


Replies

 
Daniel Williams
Reply

I have just had a similar problem, when you check "hide in menu" - it will not show in any xslt at all, therefor what i did, was to keep the page published and using the navigationtag to "navHide"

- On some pages i didnt wan't the breadcrumb shown, so i made another tag called "noBreadcrumb" which I put in the statuslineText field, in settings on a page properties.

I hope this can help you, I can tell you the customer is very happy with this solution because it gives a lot of freedom to show and hide different things.

 

 
Dmitrij Jazel
Reply

Hello Daniel,

Well, that is OK solution for me, but not for client, that is rather more difficult than just check or un-check select box :-)

 

Aniways... Well I see, it soulds like something I could use for now.

But you are still checking in XSLT for this solution like test="@textboxvalue='navHide'" etc... could you mayne give me an example of this condition from your XSLT file?

 

Thanks alot in advance :-)

 

Regards,

Dmitrij

 
Daniel Williams
Reply
This post has been marked as an answer

It is very simple:

<xsl:choose>
<xsl:when test="@NavigationTag='NavHide'">
<!--WRITE MENU-->
</xsl:when>
<xsl:otherwise>
<!--HANDLE IT-->
</xsl:otherwise>
</xsl:choose>

 

Votes for this answer: 1
 
Dmitrij Jazel
Reply

 @NavigationTag finally :)))

Well I must thank you Daniel for your help, thanks alot :)

 
Dmitrij Jazel
Reply

On another hand Daniel,

Maybe you could provide me an example of your breadcrumb xslt file? Cause now I am a bit confused how to initialise this check, because there are 2 templates in xslt file that one is called (the one that prints the pages) if conditions are OK to show it. But I am not sure how exactly to change it...

I also provide a copy of my xslt file, so we could figure out where to perform this check, if you like it this way? Just that a copy of working XSLT could just fix the issue.

 

Thanks alot again!

 

Regards,

Dmitrij

 
Daniel Williams
Reply
This post has been marked as an answer
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" encoding="utf-8"/>
  <xsl:param name="html-content-type"/>
  <xsl:template match="/NavigationTree">
    <xsl:if test="count(//Page) > 0">
      <a href="/">Frontpage</a><i> ›</i>
      <xsl:apply-templates select="//Page[@InPath='True' or @Active='True']">
        <xsl:with-param name="depth" select="1"/>
      </xsl:apply-templates>
    </xsl:if>
  </xsl:template>
  <xsl:template match="//Page[@InPath='True' or @Active='True']">
    <xsl:param name="depth"/>
    <a>
      <xsl:attribute name="href">
        <xsl:value-of select="@FriendlyHref" disable-output-escaping="yes"/>
      </xsl:attribute>
      <xsl:if test="@Active='True'">
        <xsl:attribute name="class">active</xsl:attribute>
      </xsl:if>
      <xsl:value-of select="@MenuText" disable-output-escaping="yes"/>
    </a><xsl:if test="position() != last()"><i> ›</i></xsl:if>
  </xsl:template>
</xsl:stylesheet>​

and then you use the following dwnavigation tag:

<!--@If(DwPageStatusText!='noBreadcrumb')--><nav id="breadcrumb">
            <div id="breadcrumbs" class="dwnavigation" settings="startlevel:1;endlevel:99;template:breadcrumb.xslt;expandmode:inpath;"></div>
        </nav><!--@EndIf-->

Remember that the dwnavigation element (div#breadcrumbs) will be removed when you parse the page, so it won't be showed in the DOM

 

Votes for this answer: 1

 

You must be logged in to post in the forum