Copied to clipboard

Flag this post as spam?

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


  • Jonas Eriksson 930 posts 1825 karma points
    May 26, 2010 @ 10:26
    Jonas Eriksson
    0

    What happened behind the hood with my parameter value?

    Suddenly a simple macro parameter with type mediaCurrent returned a strange non-numeric value to a Xslt.

    <umbraco:macro MediaRootId="2336" alias="DocumentsForFrontpage" runat="server"></umbraco:macro>

    And in the Xslt:

    <xsl:variable name="macroMediaRootId" select="/macro/MediaRootId"/>
    Debug: (<xsl:value-of select="$macroMediaRootId"/>)
    

    The output was 01194MyDocumentTypeAlias instead of 2336. Anyone have a clue of how that could have happened? I dont.

    Regards

    Jonas

  • Jonas Eriksson 930 posts 1825 karma points
    May 26, 2010 @ 10:43
    Jonas Eriksson
    0

    I'm not so concerned about this for the current problem, but more as a general thing. Is it a sign of some error in the site xml content?

  • Tommy Poulsen 514 posts 708 karma points
    May 26, 2010 @ 10:58
    Tommy Poulsen
    0

    Hi Jonas,

    you are rendering the full node content, you you have to reference the id specifically, e.g. like this:

    <xsl:variable name="macroMediaRootId" select="/macro/MediaRootId/node/@id">
  • Jonas Eriksson 930 posts 1825 karma points
    May 26, 2010 @ 11:21
    Jonas Eriksson
    0

    Hi Tommy, that works - great!

    But that means I have missed something essential. The info here http://umbraco.org/documentation/books/macro-parameters-syntax/setting-up-a-macro-parameter says :

    "Okey so now we have a macro with some parameters. Lets get these parameters into the xslt. 

    Our Xslt code (without the stylesheet info):

    <xsl:template match="/">
      <xsl:copy-of select="/macro/text">
      <xsl:copy-of select="/macro/contentTree"> 
    </xsl:template>

    "

    regards / Jonas

  • Jonas Eriksson 930 posts 1825 karma points
    May 26, 2010 @ 11:23
    Jonas Eriksson
    0

    Ah, stupid of me - the mediaCurrent returns whole node, ah, forget the last question.

  • Tommy Poulsen 514 posts 708 karma points
    May 26, 2010 @ 11:33
    Tommy Poulsen
    0

    Goodie - I'm glad you figured it out ;-)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies