Copied to clipboard

Flag this post as spam?

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


  • Stefan 117 posts 215 karma points
    Dec 29, 2011 @ 15:27
    Stefan
    0

    Test parent node

    Hi.

    I'm working on a site for a car dealer, and the cars will be put in one folder when they are for sale, but when they are sold, they are moved into a doctype called "ProduktgruppeSolgt".

    When browsing a car on such page, I need to substitute the price with a text saying it has been sold.

    It is the second line below that I cant figure out.

      <xsl:choose>
        <xsl:when test="$currentPage/parent = ProduktgruppeSolgt">
          <strong>SOLGT!</strong>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$currentPage/productPrice" />
          <xsl:text> DKK</xsl:text>
        </xsl:otherwise>
      </xsl:choose>

    Thanks in advance!

    Best regards
    Stefan

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 29, 2011 @ 15:29
    Jan Skovgaard
    0

    Hi Stefan

    you should probably use $currentPage/parent::ProduktgruppeSolgt instead?

    /Jan

  • Stefan 117 posts 215 karma points
    Dec 29, 2011 @ 17:12
    Stefan
    0

    Thank you - I knew it was related to the syntax I was trying to use...
    Also, how can I test if $currentPage is a certain doctype?

    One more thing, how can I easily render a macro from within another xslt file?

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Dec 29, 2011 @ 19:27
    Dennis Aaen
    1

    Hi Stefan,

    You should be able to test the if currentPage certain documentype, with something like this:

    <xsl:if test="$currentPage/self::SubPage">
      SubPage
    </xsl:if>

    <
    xsl:if test="$currentPage/self::FrontPage">
        FrontPage
    </xsl:if>

    One way you should be able to include a xslt file into another, is by using the import tag or the include tag. Chriztian Steinmeier writes some articles about it here. And comes with some examples on the use.

    http://pimpmyxslt.com/articles/include-or-import/.

    Hope it´s helps you.

    /Dennis

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 29, 2011 @ 23:15
    Jan Skovgaard
    0

    Hi Stefan

    As Dennis is saying above you should look into include or import XSLT files and I must admit it's not often that you will need to render XSLT files inside each other. Be aware though that if you're using a XSLT based macro to render content from a rich text editor (in which you can insert a xslt based macro) you will need to use the umbraco.library:RenderMacro() extension otherwise the content of the XSLT based macro will not render.

    Hope this answers your question :)

    /Jan

  • Stefan 117 posts 215 karma points
    Dec 31, 2011 @ 12:07
    Stefan
    0

    Thank you very much for your help!
    I will look into the links provided :)

    And a happy New Year to you!

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 31, 2011 @ 12:11
    Jan Skovgaard
    0

    Hi Stefan

    You're welcome.

    And a very happy new year to you! :)

    /Jan

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Dec 31, 2011 @ 15:03
    Dennis Aaen
    0

    Hi Stefan,

    Happy new year to you :) and to Jan too :)

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft