Copied to clipboard

Flag this post as spam?

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


  • Simon Dingley 1474 posts 3431 karma points c-trib
    Mar 31, 2010 @ 11:28
    Simon Dingley
    0

    MediaPicker Node Id Always Missing

    Perhaps I missing something glaringly obvious here so could do with an extra pair of eyes. I have simplified my example to make it easier to demonstrate.

    Here is my XSLT:

        <xsl:param name="currentPage"/>
        <xsl:variable name="title" select="/macro/Title" />
        <xsl:variable name="description" select="/macro/Description" />
        <xsl:variable name="source" select="/macro/Source" />
        <xsl:variable name="thumbWidth" select="/macro/ThumbWidth" />
        <xsl:variable name="thumbHeight" select="/macro/ThumbHeight" />
    
        <xsl:template match="/">
            <ul>
                <li>
                    <xsl:value-of select="$title" />
                </li>
                <li>
                    <xsl:value-of select="$description" />
                </li>
                <li>
                    <xsl:value-of select="$source" />
                </li>
                <li>
                    <xsl:value-of select="$thumbWidth" />
                </li>
                <li>
                    <xsl:value-of select="$thumbHeight" />
                </li>
            </ul>
        </xsl:template>

    Now for some reason all values are output except for $source. The datatype in the macro is a mediapicker however with debug/trace enabled on my page the macro is getting the required values so why is it not present when I try to use it or output its value?

    Stack Trace:

    renderMacro
    Rendering started (macro: Image  Gallery, type: 1, cacheRate: 0)


    umbracoMacro
    Xslt node adding search start (Title,'Sample Image Gallery')


    umbracoMacro
    Xslt node adding search start (ThumbHeight,'100')


    umbracoMacro
    Xslt node adding search start (Source,'1059')


    umbracoMacro
    Xslt node adding search start (Description,'This is a sample description of 
    the image gallery')


    umbracoMacro
    Xslt node adding search start (ThumbWidth,'100')


  • Tommy Poulsen 514 posts 708 karma points
    Mar 31, 2010 @ 11:33
    Tommy Poulsen
    3

    Hi Simon,

    if you want to get the id, you would probably want to do like this:

    <xsl:variable name="source" select="/macro/Source/node/@id" />

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 31, 2010 @ 11:35
    Lee Kelleher
    1

    Hi Simon,

    Try dumping out the contents of the <macro> nodes... see whats getting through?

    <xmp><xsl:copy-of select="/" /></xmp>

    I looked for a typo, but everything seems correct.

    Cheers, Lee.

  • Simon Dingley 1474 posts 3431 karma points c-trib
    Mar 31, 2010 @ 11:45
    Simon Dingley
    0

    Thanks guys, I should have learnt by now as every time I use the mediaCurrent datatype I have problems like this. Lee, thanks your solution helped me spot the issue Tommy identified above. Out of interest what are the xmp tags?

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 31, 2010 @ 12:09
    Lee Kelleher
    0

    <xmp> tags are to display 'example code' snippets.  Part of HTML 3.2 and has been deprecated. They work the same as <pre> tags, but renders out less/greater-thans (instead of escaping them like <pre> does).  As far as I'm aware none of the browsers have dropped support for it... so I'll keep using it for dev work.

    I will stress that I only use this tag for debugging purposes ... never use it on a live site.

    http://www.w3.org/TR/REC-html32#xmp

Please Sign in or register to post replies

Write your reply to:

Draft