Copied to clipboard

Flag this post as spam?

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


  • Frederik T 241 posts 372 karma points
    Aug 17, 2011 @ 13:08
    Frederik T
    0

    Checking if xslt is on specific page, xpath problem perhaps?

    This is a problem from the topic i made here:
    http://our.umbraco.org/forum/developers/xslt/23187-Help-tidying-up-and-fixing-errors-with-a-List-Rotator'

    But i thought it would be easier to get help if i took the specific problem out and made a seperate thread.

    In the meantime ive fixed many bugs etc, but one thing i just cant wrap my head around is, is xpath.

    The rotator mentioned in the post i linked to above, is used on three pages:
    -The main front page, the one visitors first see when they open the website
    -Main page of two seperate sub sections

    -Main (rotator here)
    --Sub-section1 (rotator here)
    ----blabla
    --Sub-section2 (rotator here)
    ----blabla

    The same rotator is used in all three places, and i need to somehow check in the xslt, if the rotator is on the front page, or a sub section. the reason for this is, it displays featured articles, so the document template has two booleans that determines if its featured on the front page or a sub section.

     

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Aug 17, 2011 @ 13:48
    Tom Fulton
    0

    Hi Frederik,

    The best way is probably to check by the Document Type, assuming they are different, or by the level.

    <xsl:if test="$currentPage/self::MainDocTypeAlias">This page is using the "MainDocTypeAlias" doctype</xsl:if>
    <xsl:choose>
     <xsl:when test="$currentPage/@level = 1">Level 1 (Main)</xsl:when>
     <xsl:when test="$currentPage/@level = 2">Level 2 (Sub)</xsl:when>
     <xsl:otherwise>something else...</xsl:otherwise>
    </xsl:choose>

    -Tom

  • Frederik T 241 posts 372 karma points
    Aug 17, 2011 @ 14:09
    Frederik T
    0

    Thank you for your reply, the "level" looks exactly like what i need. But regardless of where i put the "when" it gives off and error, either theres and error with the tag placement or it cant be a child of a "div" element which the xslt is ridden with. The code is linked to in my original post above.

    If you have a suggestion as to where would be hte most logical choice to use it, i would be most grateful, in the meantime i will try and experiment.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Aug 17, 2011 @ 14:13
    Tom Fulton
    0

    Hi, did you enclose the <xsl:when> in the <xsl:choose> like above?  Can you paste the code you added for some context?  You should be able to use it just about anywhere..

    -Tom

  • Frederik T 241 posts 372 karma points
    Aug 17, 2011 @ 14:21
    Frederik T
    0

    Ok, this is strange, i did what you said to begin with, but it didnt work regardless of how, now i tried again after your post and it works.

    But god is it ugly :p, the code was ugly to begin with, now there is the exact same code in both "when" just checking for a different boolean.

    Oh well, it works, i will return to it when i know about xsl:template, thank you very much again :)

Please Sign in or register to post replies

Write your reply to:

Draft