Copied to clipboard

Flag this post as spam?

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


  • Owen Hope 119 posts 140 karma points
    May 06, 2011 @ 01:29
    Owen Hope
    0

    Get Property from Home Node, use it on Content Page

    Hello,

    I am trying to get some values from my "Home Node" properties.

    On everypage there is a sidebar, and I need to set up some video attributes based on some properties set on the home node. The home node is a different document type than that of the content pages (with sidebar).

    I wrote a XSLT file to get the values and pass them to my template on which they will be used in another macro to render the videos.

    Here is what I have done so far.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">
    <xsl:variable name="homeNode" select="umbraco.library:GetXmlNodeById(2986)"/>
    <xsl:value-of select="$homeNode/video1NodeID" disable-output-escaping="yes"/>
    </xsl:template>

    Now 2986 is the Home Node.

    video1NodeID is a string value of the "VideoNode"

    On my template I currently have

    <umbraco:Macro Alias="GetVideo1" runat="server"></umbraco:Macro>
    

    <div class="callout">
    <h3>ensemble videos</h3>
    <ul>
    <li>
    <!-- here is where i need to get the value of the "GetVideo1" macro and pass it into this macro where VideoID is.-->
    <umbraco:Macro VideoID="" VideoThumbnailURL="" Alias="HomepageGallery" runat="server"></umbraco:Macro>
    </li>
    </ul>
    <a href="/video-galleries" title="view more ensemble videos">view more videos &raquo;</a>

     

    I am fairly stuck and kinda new to XSLT.

     

    Current version is 4.0.2.1

    Thanks,

     

    Owen

  • Sean Holmesby 61 posts 82 karma points
    May 06, 2011 @ 03:28
    Sean Holmesby
    0

    Hi Owen,

    Instead of passing the value of one macro to another through a template, is it possible to just use that code within the 'HomepageGallery' macro?

    What is the HomepageGallery macro? An xslt, ascx, or other?

    - Sean

  • Pasang Tamang 258 posts 458 karma points
    May 06, 2011 @ 03:45
    Pasang Tamang
    0

    Hi Owen

    To get the home node you can do like this <xsl:variable name="homeNode" select="$currentPage/ancesor-or-self::node [@level=1]"/>  and try moving  this line <umbraco:Macro Alias="GetVideo1" runat="server"></umbraco:Macro> within the li block.

    Hope this helps

    Thanks

    Pnima

  • 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