Copied to clipboard

Flag this post as spam?

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


  • sun 403 posts 395 karma points
    Nov 18, 2010 @ 07:47
    sun
    0

    How to get a number passed by macro in 4.5.2(new schema)?

    I do it like that:

    <variable name="width" select="number(macro/width)"/>

    but $width has nothing

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Nov 18, 2010 @ 08:59
    Chriztian Steinmeier
    0

    Hi sun,

    This will work anywhere inside an XSLT file:

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

    (You missed the forward slash before macro, so yours would only work inside the match="/" template)

    /Chriztian

  • sun 403 posts 395 karma points
    Nov 18, 2010 @ 11:19
    sun
    0

    <xsl:variable name="height" select="number(/macro/height)"/>

    I do it like you said, but it has nothing changed.

    this is work with Umbraco 4.0.4.2

    But I don't know why it can't work with Umbraco 4.5.2(new schema)


  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Nov 18, 2010 @ 11:28
    Chriztian Steinmeier
    0

    Hi sun,

    This will be no different regardless of the schema used, but I seem to remember that .NET will overrule macroparameters with names like "height", "width", "cssClass" (and some others) because they end up as attributes on the <umbraco:Macro> UserControl that's used in the Template.

    Try renaming the parameters to setWidth, setHeight or something similar (remember to change the reference in XSLT too).

    /Chriztian 

  • sun 403 posts 395 karma points
    Nov 18, 2010 @ 11:56
    sun
    0

    thanks for your great answer. I have resolved it.

  • 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