Copied to clipboard

Flag this post as spam?

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


  • Hundebol 167 posts 314 karma points
    Sep 08, 2009 @ 12:19
    Hundebol
    0

    Output the path chosen in macro

    Hi,

    I have a macro which can be used in the richtext editor. It is for inserting flash.

    When the end-user inserts the macro, the user must set the path (via mediaCurrent) and the width and height (as numbers)

    The width and height works fine, and the path almost works!

    my xlst for the path looks like this:

    <xsl:value-of select="/macro/videopath" />

    Where "videopath" is the alias of the parameter set in the macro.

    this xslt gives me this in the html: /media/25565/flvplayer_progressive.swfswf9038 - i want to get rid of the bold part (swf9038)

    but how to?

    i have with different versions of alias = 'umbracoFile' but it gives errors - probably because the syntax is not correct.

    Best regards
    Brian

  • dandrayne 1138 posts 2262 karma points
    Sep 08, 2009 @ 12:47
    dandrayne
    0

    This isnt how i remember it, but the code below seems to work for me in another site

    <xsl:variable name="videoName" select="umbraco.library:GetMedia(/macro/videopath, 'false')/data [@alias = 'umbracoFile']" />

     

    If this doesnt work, use

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

    and see what come out, then adjust the xpath to suit

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Sep 08, 2009 @ 12:47
    Douglas Robar
    0

    'mediaCurrent' is just like a Media Picker on a document type. I mention this so you can search for forum for more info on the GetMedia() function if you're interested. That will explain the other information that is appended to the end.

    But without forcing you to read more if you're not overly interested in 'why'... the solution is the following:

    <xsl:value-of select="/macro/videopath/data[@alias='umbracoFile']" />

    cheers,
    doug.

  • Tommy Poulsen 514 posts 708 karma points
    Sep 08, 2009 @ 12:47
    Tommy Poulsen
    0

    You are outputting all cpntent of the videopath node - thats why you get too much text.

    Instead you need to select the specific field of interest.

    E.g. like this:

    <xsl:variable name="MediaNodeId" select="/macro/MediaNode/node/@id"/>
    <xsl:value-of select="umbraco.library:GetMedia($MediaNodeId, 'false')/data [@alias = 'umbracoFile']"/>

     

    >Tommy

     

  • Hundebol 167 posts 314 karma points
    Sep 08, 2009 @ 13:34
    Hundebol
    0

    Hi all!

    Thank for your suggestions - none of them are however working though (or i'm not inserting them right!)

    Douglas: You code-snippet i have tried, and i have iterated through the forum without finding anything i could use.

    My xlst looks like this, if this is of any help:

    <xsl:template match="/">

    <!-- start writing XSLT -->

    <div id="flashcontent">
      This text is replaced by the Flash movie.
    </div>

    <script type="text/javascript">
       var so = new SWFObject("MISSING CODE HERE", "flashcontent", "<xsl:value-of select="/macro/videowidth" />", "<xsl:value-of select="/macro/videoheight" />", "8", "#FFFFFF");
       so.addParam("wmode", "transparent");
       so.write("flashcontent");
    </script>

    </xsl:template>

    i have written "MISSING CODE HERE" where i need to insert the parameter.

    Hope that someone would like to help out a xslt-newbie :)

    best regards,
    Brian

  • dandrayne 1138 posts 2262 karma points
    Sep 08, 2009 @ 14:28
    dandrayne
    0

    This may or may not be related to your problem - but the embed code there is for swfobject 1.5, so if you're using swfobject 2.2 it won't work.

    Other than that, do

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

    And post what comes out.  I'm almost certain that the solution is in at least one of the above posts!

  • Hundebol 167 posts 314 karma points
    Sep 08, 2009 @ 14:45
    Hundebol
    0

    Hi Dan

    I know it is for swfobject 1.5. That is because of the different way the two are implemented. In 2.2 the code is all in the head, while in 1.5 it's all in the body - i think, for this particular thing, where the end-user have to insert in the richtext editor - that the 1.5 is the easiest one as i can insert all at once. Maybe i'm wrong, but I know this one works when hardcoded.

    The code outputs the following in the html:

    <videopath>
    <node id="1817" version="11d0e8e6-989a-4b06-8fbd-eb3eaf79b9d5" parentID="1814" level="2" writerID="2" nodeType="1033" template="0" sortOrder="1" createDate="2009-09-04T12:43:31" updateDate="2009-09-04T12:43:31" nodeName="FLVPlayer" urlName="flvplayer" writerName="Dorthe" nodeTypeAlias="File" path="-1,1814,1817">
    <data alias="umbracoFile">/media/25565/flvplayer_progressive.swf</data>
    <data alias="umbracoExtension">swf</data>
    <data alias="umbracoBytes">9038</data>
    </node>
    </videopath>

    So, I know it is the bold part i need to get my hands on. But just can't seem to get it to work.

    Any ideas

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 08, 2009 @ 14:56
    Dirk De Grave
    0

    Hi Brian,

    Me thinks you need this:

    <xsl:value-of select="/macro/videopath//data[@alias='umbracoFile']" />

    It's almost identical to Doug's suggestion, except for the '//' selector instead of '/'. It's shorthand for find a data node regardless of its level for which alias attribute has a value equal to 'umbracoFile'

    Cheers,

    /Dirk

  • Hundebol 167 posts 314 karma points
    Sep 08, 2009 @ 15:27
    Hundebol
    0

    Hi Dirk!

    Me think you are right - that is so great! You just saved my until now very bad Umbraco day :)

    Thanks to all for your help!

    best regards,
    Brian

Please Sign in or register to post replies

Write your reply to:

Draft