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!
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>&height=</xsl:text>
<xsl:value-of select="$height" />
<xsl:text>&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?
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.
Hi
Thank you for the answer!
The outpost of debug is:
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...
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.
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?
... or try renaming it to "imgHeight"? See if that works?
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
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.
is working on a reply...