Copied to clipboard

Flag this post as spam?

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


  • Lars Mortensen 90 posts 98 karma points
    Nov 13, 2010 @ 12:32
    Lars Mortensen
    0

    Variable

    Hey

    Using the newest umbraco, but still the old XSLT.
    I im trying to use variables but can't find out how to display the variable e.g. :

    <xsl:variable name="imgAlias"  select="/macro/imgAlias"/>
    <xsl:variable name="height" select="/macro/height"/>
    <img>
     <xsl:attribute name="src">
      <xsl:text>/umbraco/ImageGen.ashx?image=</xsl:text>
      <xsl:value-of select="umbraco.library:GetMedia($currentPage/ancestor-or-self::node/data [@alias=$imgAlias] [position()=last()], false )/data [@alias='umbracoFile']"/>
      <xsl:text>&amp;height=</xsl:text>
      <xsl:value-of select="$height" />
      <xsl:text>&amp;constrain=true</xsl:text>
     </xsl:attribute>
     <xsl:attribute name="style">
      <xsl:text>border: 2;</xsl:text>
     </xsl:attribute>
    </img>

    The imgAlias is working fine, but the height isn't, what am I missing?

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Nov 13, 2010 @ 12:56
    Lee Kelleher
    0

    Hi Lars,

    The syntax of your XSLT looks correct to me!  What is being outputted for the $height?

    You might want to try appending "?umbDebug=true" to your URL, so you can see what the /macro values being passed through are?

    Cheers, Lee.

  • Lars Mortensen 90 posts 98 karma points
    Nov 13, 2010 @ 13:58
    Lars Mortensen
    0

    Hi

    Thank you for the answer!

    The outpost of debug is:

    Debug
    from Media Pic To Img


    <macro><imgAlias>kEHead</imgAlias></macro>

    I have add'ed the height as a parameter to the macro

    and the html code is:

    <a href="/"><umbraco:Macro imgAlias="kELogo" ahref="Ahref" height="123" Alias="MediaPicToImg" runat="server"></umbraco:Macro></a>

    I have just tried to change everything to vheight if it was a reserved word or something like that...

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Nov 13, 2010 @ 15:00
    Lee Kelleher
    0

    Hi Lars,

    It should work now that you've added the "height" parameter to the macro?  What does the "?umbDebug=true" show now?

    Thanks, Lee.

  • Lars Mortensen 90 posts 98 karma points
    Nov 15, 2010 @ 11:18
    Lars Mortensen
    0

    Hi

    The height has been added to the parameter all the time, it was just an info, so you knew that it was added :)

    So it looks like theres somting that blocks the parameter.

    Should I try to delete the macro (not xslt) and try again?

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Nov 15, 2010 @ 11:23
    Lee Kelleher
    0

    ... or try renaming it to "imgHeight"? See if that works?

  • Lars Mortensen 90 posts 98 karma points
    Nov 15, 2010 @ 21:43
    Lars Mortensen
    0

    I knew that someone was working on the site, so I wold not mess to much up "on the fly", so I creted a new xslt file with new macro, added the parameters changed the HTML on a test site, and it worked.

    Then I deleted the original, renamed my test so it was called the same, adjusted the HTML code to pass the imgheight parameter intead of height and it stil works!

    Thank you for the help!

    Regards Lars Mortensen

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Nov 16, 2010 @ 11:14
    Lee Kelleher
    0

    Hi Lars,

    Glad that you got it to work!  Curious about naming the macro param as "height" ... I'll test it out later.

    Cheers, Lee.

Please Sign in or register to post replies

Write your reply to:

Draft