Copied to clipboard

Flag this post as spam?

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


  • Philip 13 posts 33 karma points
    Jun 17, 2011 @ 13:02
    Philip
    0

    Can't display parameter?

    Hi,

    Sorry if this is really simple/doesn't make much sense - my knowledge of XSLT is rather limited.

    I can't seem to set a param and have it pull through on the front end.

    The param in question is 'month-id'. When I replace the following line:

    <xsl:value-of select="$month-id" />

    with this line:

    <xsl:value-of select="umbraco.library:FormatDateTime(pressDate, 'MMMM yyyy')/>

    the value is pulled through as normal. But I can't get it to function as a param and have it pull through just by referencing the param's name. Here's the full markup:

    <xsl:param name="month-id" select="umbraco.library:FormatDateTime(pressDate, 'MMMM yyyy')"/>
    <xsl:template match="/">
     

    <div id="featureNewsItem">
      <xsl:for-each select="$currentPage/pressArticle[position()=1]" >
        <div>
          
          <xsl:value-of select="$month-id" />
          
        <img src="{imageOne}" height="130" alt="" style="float:left;" />
        <div style="width:570px;">
        <img width="149" height="58" src="{pressTopLogo}" />
        </div>
        <span style="color:#E70079;font-size:1.4em;margin-left:7px;">
          <xsl:value-of select="articleHeadline" />
        </span>
        

        <div style="margin-left:13px;">
          <xsl:value-of select="newsStory" disable-output-escaping="yes"/>
      </div>
        


        <id="ctl00_ctl00_ctl00_ContentPlaceHolderDefault_C2kMasterPlaceholder_NewsSectionManagementArea_5_hlHeadlineTop" href="{umbraco.library:NiceUrl(@id)}">

          

        </a>
    </div>

      </xsl:for-each>

     

    Thanks for any help!

    Philip

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 17, 2011 @ 13:26
    Tom Fulton
    0

    Hi Philip,

    In order to use a macro parameter, you first need to add the parameter to the Macro under Developer -> Macros - (your macro) - Parameters tab, and click the Show checkbox. (You probably already did this?)

    Then in your code you need:

    <xsl:param name="month-id" select="/macro/yourParameterAlias" />

    Then you can use $month-id

    Hope this helps,
    Tom

  • Philip 13 posts 33 karma points
    Jun 17, 2011 @ 17:31
    Philip
    0

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft