Copied to clipboard

Flag this post as spam?

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


  • chris reed 5 posts 25 karma points
    Jun 16, 2011 @ 13:30
    chris reed
    0

    Return property value based on variable

    Hi all,

    I have a macro which has a parameter using propertyTypePicker with an alias of option1. The option selected within the picker is cmsWebsite

    Within my xslt I want to use this parameter to display the value of cmsWebsite. Sounds simple enough doesn't it. 

    So within my xslt I have set up a variable:

    <xsl:variable name="opt1" select="/macro/option1"/>

    <xsl:for-each select="umbraco.library:GetXmlNodeById(XXX)/* [@isDoc and string(umbracoNaviHide) != '1']">

    <xsl-value-of select="$opt1" /> //Prints out the words option1

    <xsl-value-of select="cmsWebsite" /> //Works - prints out the web address (test to see that it does work)

    <xsl:value-of select="umbraco.library:GetItem(@id, $opt1)"/> //returns blank
    <xsl:value-of select="umbraco.library:GetItem($opt1)"/> //returns blank

    <xsl:value-of select="umbraco.library:GetXmlNodeById(XXX)/$opt1" /> //breaks the xslt and causes the page to macro to error if errors are ignored.

    </xsl:for-each>

    I would really appreciate it if anyone could put me in the right direction.

    Thanks

    Chris

  • chris reed 5 posts 25 karma points
    Jun 16, 2011 @ 13:31
    chris reed
    0

    <xsl-value-of select="$opt1" /> //prints out cmsWebsite not option1. Sorry

  • chris reed 5 posts 25 karma points
    Jun 16, 2011 @ 17:07
    chris reed
    0

    In case anyone else is having the same problem the following code is all you need:

    <xsl-value-of select="umbraco.library:GetXmlNodeById(XXX)/*[name() = $opt1]" />

    Thanks
    Chris

  • 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