Copied to clipboard

Flag this post as spam?

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


  • Brian A 13 posts 34 karma points
    Apr 21, 2011 @ 20:37
    Brian A
    0

    mediaCurrent on image folder (4.6.1)

    Hi All,

    After searching through the forum and googling for hours I give up.

    Mission: output a img tag for all images in a media folder - as many do.

    I simply cannot get the folder id from a mediaCurrent parameter through xslt.

    So:

    Parameter: StartNode created and checked "show" and selecting mediaCurrent as type.

    My script works perfectly using the hardcoded version:

    <xsl:variable name="StartNode" select="2361" /> 

    But changing it to will not give any output (or id of the folder):

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

    $StartNode is blank if I do a value-of.

    If I do:

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

    html output is:

    <startnode>
      <folder id="2361" version="b29f1967-7cec-4521-bc88-e880305b98c8" parentid="1116" level="2" writerid="0" nodetype="1031" template="0" sortorder="0" createdate="2011-04-21T10:57:30" updatedate="2011-04-21T10:57:32" nodename="Forside Fades" urlname="forsidefades" writername="Administrator" nodetypealias="Folder" path="-1,1116,2361">
        <contents></contents>
      </folder>
    </startnode>

    So it tells me that StartNode contains valid info.

    Have also tried this (with a value-of):

    <xsl:variable name="StartNode" select="/macro/StartNode/folder/@id" /> 

    Which doesn't work either. I've followed all things from BlackPoint without any luck.

    Maybe there's something funny about the 4.6.1 or just me!

    Thanks!

    /Brian

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 21, 2011 @ 20:41
    Jan Skovgaard
    1

    Hi Brian

    I think the problem is with this line

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

    Notice the "node" element in there? Since you're using version 4.6.1 you are using the new XSLT syntax, which you have been doing in the whole file but in that line there is a reference to "node", which should probably NOT be there :-)

    Does it help to remove it?

    /Jan

  • Brian A 13 posts 34 karma points
    Apr 21, 2011 @ 21:05
    Brian A
    0

    Hej Jan,

    Thanks for you reply.

    That didn't work either so I would be(?):

    <xsl:variable name="StartNode" select="/macro/StartNode/@id"/>

    Just empty ..... sooo strange!

    According to BlackPoint 4.0 -> 4.5 converter there should be no difference between the two version on how this should be written.

    /Brian

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 21, 2011 @ 21:08
    Jan Skovgaard
    0

    Hi Brian...

    Hmm...does the StartNode alias exist on the parameter? And if so...does it in fact have a value?

    /Jan

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Apr 21, 2011 @ 21:16
    Tom Fulton
    0

    Hi Brian,

    Jan's right, you should replace node with the alias of the media type you are expecting, so /macro/StartNode/folder/@id should work

    ...however, are you sure it's "folder" and not "Folder"?  I see that your HTML output is lowercase but not sure how, the default media type is "Folder".

    What you also might try is just replacing it with * to handle any media type, ex:

    <xsl:variable name="StartNode" select="/macro/StartNode/*/@id"/>

    Hope this helps,
    Tom

  • Brian A 13 posts 34 karma points
    Apr 21, 2011 @ 21:17
    Brian A
    0

    Hi Jan,

    Yes, otherwise I would not be able to get any output of the StartNode "copy-of" (see the above html output) which states the correct folder id (2361).

    I'm inserting the macro in tiny mce which gives this html:

    <div class="umbMacroHolder" title="This is rendered content from macro" umbpageid="1094" umbversionid="124e3c81-49ff-4c3d-8134-8315c4e929b2" onresizestart="return false;" ismacro="true" umb_startnode="2361" umb_macroalias="FadePictures"><!-- startUmbMacro --><!-- endUmbMacro --></div>

    So umb_startnode is there and passed on to xslt.

    /Brian

  • Brian A 13 posts 34 karma points
    Apr 21, 2011 @ 22:03
    Brian A
    0

    Tom,

    Tried that - still the same - no output.

    If I use the /*/@id then I get an error when loading the page:

    Error parsing XSLT file: \xslt\FadePictures.xslt

    /Brian

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Apr 21, 2011 @ 22:24
    Tom Fulton
    1

    Hmm *scratches head*

    I just tested this on a 4.6.1 install and it worked perfectly using mediaCurrent as the parameter with a Folder selected

    ID:  <xsl:value-of select="/macro/StartNode/*/@id"/>

    Just for kicks can you try getting rid of all your other code temporarily and just write that out and see if you get the ID?

    Otherwise maybe verify your xml again with

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

    Other than that I'm a bit stumped :)

    -Tom

  • Brian A 13 posts 34 karma points
    Apr 21, 2011 @ 22:51
    Brian A
    0

    Solved!

    I can't explain what just happened - but this worked now (very sure I have tried this before): 

    <xsl:variable name="StartNode" select="/macro/StartNode/Folder/@id"/>

    And also the /*/@id worked

    Our Umbraco host provider has just experienced a minor hack on their system and I still havin' trouble getting XSLTsearch to work again (the .cs file can't run!?)

    So maybe they did something on the server...

    Thanks guys for all your help!

    /Brian

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 21, 2011 @ 22:53
    Jan Skovgaard
    0

    Hi Brian

    That's good to hear. You have probably had the right idea but perhaps there has been one of those hard-to-catch typos that can drive one nuts. And of course if there is something going on on the server it can also confuse things of course.

    But glad you're able to move on :-)

    /Jan

  • Fergus Davidson 309 posts 588 karma points
    Jul 13, 2012 @ 12:17
    Fergus Davidson
    0

    i know this is an old post, but i have been struggling with this for the last few hours, but i found a solution which may help others.

    i have a macro for use in an RTE, with a parameter called mediaFolder which is of the mediaCurrent variety.

    after trying countless variations, when ever i request the id, i got nothing back. UNTIL i used 'string()' as below:

    <xsl:param name="imgs" select="string(/macro/mediaFolder/Folder/@id)"/>

    Hope this helps someone else....

Please Sign in or register to post replies

Write your reply to:

Draft