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
    Feb 21, 2012 @ 13:09
    Kelvin Thursby
    0

    Getting Page content from the node value

    Hi all,

    I am trying to insert data from another page related to the node that is selected from the content picker

    I currently have in my macro which gives me the node value which i want

     <xsl:copy-of select="/macro/link"/>

    Now I am stuck with what to put in my template to show content from this page.

    A property for the page is called 'mainHeading' so i have tried (with no luck)

     <xsl:copy-of select="$link/data[@alias='mainHeading']" />

    Any help on this would be greatly appreciated!

    Kelvin

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Feb 21, 2012 @ 14:17
    Thomas Höhler
    0

    If you are using the content picker it stores only the id of the selected node. So just use 

    <xsl:copy-of select="umbraco.library:GetXmlNodeById(/macro/link)/data [@alias='mainHeading']" />

    as you are using the old xml schema.

    hth, Thomas

  • Kelvin Thursby 16 posts 36 karma points
    Feb 21, 2012 @ 15:17
    Kelvin Thursby
    0

    Hi,

    I tried using this and nothing is displayed. Should i not use the old xml schema?

    Do you have any other advice?

    Thanks

    Kelvin

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Feb 21, 2012 @ 21:41
    Thomas Höhler
    0

    Go step by step.

    1. check if the macro value is there correctly
    2. check if the macro value is the id of the selected node
    3. check if the umbraco.library:GetXmlNodeById(/macro/link) returns the node
    4. check if the property alias is spelled correctly. 
    hth, Thomas
  • Kelvin Thursby 16 posts 36 karma points
    Feb 22, 2012 @ 10:26
    Kelvin Thursby
    0

    Hi Thomas,

    I have check and the first three work

    the code below gives me all the details in the specified node:

    <xsl:copy-of select="umbraco.library:GetXmlNodeById(/macro/link)"/>

    the page it is using is called Article and has properties which has the alias of mainHeading,subHeading,leftColumn.

    leftColumn is a richtext and the others are a textstring. when i complete the code with (below) nothing happens.

     <xsl:copy-of select="umbraco.library:GetXmlNodeById(/macro/link)/data [@alias='mainHeading']" />

    the last bit of the code isn't working.

    Some more help would be great!

    Thanks

    Kelvin

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Feb 22, 2012 @ 11:41
    Thomas Höhler
    0

    are you sure you are using the old xml schema. Please check the Umbraco Version and if it is 4.5 or higher check the config/umbracoSettings.config there is an element called UseLegacyXmlSchema if the value is set to false you are using the new schema if it is set to true you are using the old schema.

    In the new schema it has then to be:

    <xsl:copy-of select="umbraco.library:GetXmlNodeById(/macro/link)/mainHeading" />

    just output the xml you get via

    <textarea><xsl:copy-of select="umbraco.library:GetXmlNodeById(/macro/link)" /></textarea>

    then you can see what xml stucture you have

    hth, Thomas

  • Kelvin Thursby 16 posts 36 karma points
    Feb 23, 2012 @ 13:01
    Kelvin Thursby
    0

    Great!! Thank you this works,

    I guess i am confusing the old with the new... Thanks again

    <xsl:copy-of select="umbraco.library:GetXmlNodeById(/macro/link)/mainHeading" />

Please Sign in or register to post replies

Write your reply to:

Draft