Copied to clipboard

Flag this post as spam?

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


  • jivan thapa 194 posts 681 karma points
    May 02, 2011 @ 15:09
    jivan thapa
    0

    retrieve macro value using Xslt problem

    I created macro parameter.

     

     

    In NewsList.xslt

     

    ... I interted that macro in Content Page. i also provide parameters value 5 in content page. ....

    But When i try to retrieve macro value, value its empty.

    if we look currentPage there is macro value .

     

     

    You can see:

    1) Macro value: is empty

    2) Curent page. numberofnewsitems="5"

    3) copy of : is empty..

     

    how to solve that problem?

    umbraco version 4.7

    thanks.

     

     

     

     

     

     

     

     

     

  • Michael Latouche 504 posts 819 karma points MVP 4x c-trib
    May 02, 2011 @ 15:40
    Michael Latouche
    0

    Hi Jeevan,

    Have you tried changing the parameter alias name to all lower-case? I had a similar issue, and changing the alias name to all lower-case solved it. I hope it does in your case too :-)

    Cheers,

    Michael.

  • Kim Andersen 1447 posts 2196 karma points MVP
    May 02, 2011 @ 20:59
    Kim Andersen
    1

    Hi Jeevan

    I'm pretty sure that the macro aliases are case sensitive just like property alias'es etc. So you need to specify the exact same name as the alias. THis means that you must change your variable to this:

    <xsl:variable name="numberOfNewsItems" select="/macro/numberOfNewsItems" />

    Does this work?

    /Kim A

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    May 02, 2011 @ 22:19
    Chriztian Steinmeier
    0

    Hi jeevan,

    Because the alias gets passed to the macro as a child element of <macro> it is (as Michael and Kim alludes to) in fact case sensitive (because XML is case sensitive, that is).

    Also: When using the XSLT Visualizer, it's very important you need to wrap stuff you want to debug in a textarea because the visualizer messes with the output (lowercasing as it see fit, etc.).

    /Chriztian  

  • Michael Latouche 504 posts 819 karma points MVP 4x c-trib
    May 02, 2011 @ 23:12
    Michael Latouche
    0

    Hi,

    To give some more info about the problem I faced: I had initially created a parameter with capital letters in the name, and I used the same name in my xslt. But for some reason, when rendering the macro in RTE, the parameter name was lower-cased bye default, which meant that my xslt variable, like in Kim's example, did not return anything. Like I mentioned, I solved the problem by putting everything small letter: parameter name, xslt variable filter, etc.

    Cheers,

    Michael.

  • jivan thapa 194 posts 681 karma points
    May 03, 2011 @ 00:06
    jivan thapa
    0

    Thank you so much Michael, chiriztian and Kim.

    . it was cas sensitive problem. now its working.

    ..........

    Jivan

  • Daniel Bardi 927 posts 2562 karma points
    May 04, 2011 @ 01:59
    Daniel Bardi
    0

    Damn.. 1 day too late on this.. I knew the answer.

Please Sign in or register to post replies

Write your reply to:

Draft