Copied to clipboard

Flag this post as spam?

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


  • Kelvin Thursby 16 posts 36 karma points
    Mar 09, 2012 @ 11:58
    Kelvin Thursby
    0

    adding a value from the macro to the template

    Hi,

    (Sorry I have added this in template section but think it is probably and xslt question)

    I have a macro which will be recursive. The macro starts by getting the values passed in the page

    <xsl:param name="link1" select="/macro/link1"/>
    <xsl:param name="link2" select="/macro/link2"/>

    <xsl:param name="dat1" select="umbraco.library:GetXmlNodeById($link1)"/>
    <xsl:param name="dat2" select="umbraco.library:GetXmlNodeById($link2)"/>

    then a template will be selected

    <xsl:call-template name="DoSlider" /> (more code left out for ease - but it needs to be called like this)

    and from that template i want to call another template recursivly for a list it

    <ul class="touchcarousel-container">
    <xsl:call-template name="SliderTemplate" slide="[$dat1]" />

    <xsl:call-template name="SliderTemplate" slide="[$dat2]" />
    </ul>

    in the other template call something like this

    <xsl:template name="SliderTemplate">
    <xsl:param name="dat" select="$slide"/>

    But it doesn't like the slide="[$dat2]" bit and probably the select="$slide"

    Can anyone help with this.

    Thanks

    Kelvin

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Mar 09, 2012 @ 12:05
    Chriztian Steinmeier
    0

    Hi Kelvin,

    You pass parameters with the xsl:with-parameter instruction, like this:

     <ul class="touchcarousel-container">
        <xsl:call-template name="SliderTemplate">
            <xsl:with-param name="slide" select="$dat1" />
        </xsl:call-template>
    
        <xsl:call-template name="SliderTemplate">
            <xsl:with-param name="slide" select="$dat2" />
        </xsl:call-template>
    </ul>

    (Updated original, as I misunderstood the question initially)

    /Chriztian

  • Kelvin Thursby 16 posts 36 karma points
    Mar 09, 2012 @ 12:20
    Kelvin Thursby
    0

    I keep getting this

    Error in XSLT at line 89, char 15
    87:       <ul class="touchcarousel-container">
    88:       <xsl:call-template name="SliderTemplate">
    89: >>>   <xsl:with-param name="slide" select="$dat1" /> <<<
    90:       </xsl:call-template>

    is it $dat1 ?

    dat1 comes from

     <xsl:param name="dat1" select="umbraco.library:GetXmlNodeById($link1)"/>

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Mar 09, 2012 @ 12:26
    Chriztian Steinmeier
    0

    Hi Kelvin,

    What does the error say?

    /Chriztian

  • Kelvin Thursby 16 posts 36 karma points
    Mar 09, 2012 @ 12:31
    Kelvin Thursby
    0

    This is all the error i am getting

    Error in XSLT at line 89, char 15
    87: <ul class="touchcarousel-container">
    88: <xsl:call-template name="SliderTemplate">
    89: >>> <xsl:with-param name="slide" select="$dat1" /> <<<
    90: </xsl:call-template>

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Mar 09, 2012 @ 12:37
    Chriztian Steinmeier
    0

    OK - you can try adding ?umbDebugShowTrace=True to the URL of the page that fails, to see if you get a better errordescription (may not be possible).

     

    So, the $dat1 parameter has to be in scope at the time you use it in the call to the SliderTemplate template - do you know what that means - can you check that? Otherwise, you need to post a larger chunk of the XSLT so I can see what's going on.

    /Chriztian 

  • Kelvin Thursby 16 posts 36 karma points
    Mar 09, 2012 @ 13:50
    Kelvin Thursby
    0

    Yes it works that now works thank you.

    I do still have a problem but think it is a different issue. I'll post it up on another post!!

    Thanks

     

  • 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