Copied to clipboard

Flag this post as spam?

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


  • Bjarne Fyrstenborg 1284 posts 4038 karma points MVP 8x c-trib
    Dec 12, 2011 @ 12:42
    Bjarne Fyrstenborg
    0

    Insert YouTube video with ID

    Hi..

    I am trying to insert a YouTube from xslt.. it shows the video with this code:

    <object type="application/x-shockwave-flash" style="width:480px; height:360px;" data="http://www.youtube.com/v/tEdPJaq6t9s?autoplay=0&amp;version=3&amp;fs=1" allowscriptaccess="always" allowfullscreen="true">
      <param name="movie" value="http://www.youtube.com/v/tEdPJaq6t9s?autoplay=0&amp;version=3&amp;fs=1" /><param name="allowFullScreen" value="true" />
      <param name="allowFullScreen" value="true" />
      <param name="allowscriptaccess" value="always" />
      <param name="wmode" value="transparent"></param>
    </object>

    but I would like to insert the video if the end-user has specified a YouTube video id. Right now I have just tried with a variable, but it doesn't seem to work.. in the output the variable doesn't return any output.. I will later create a property on the doc type to enter the id, but this should also work.

     

    <xsl:variable name="videoID" select="tEdPJaq6t9s"/>

    <
    object type="application/x-shockwave-flash" style="width:480px; height:360px;" data="http://www.youtube.com/v/{$videoID}?autoplay=0&amp;version=3&amp;fs=1" allowscriptaccess="always" allowfullscreen="true">
      <param name="movie" value="http://www.youtube.com/v/{$videoID}?autoplay=0&amp;version=3&amp;fs=1" /><param name="allowFullScreen" value="true" />
      <param name="allowFullScreen" value="true" />
      <param name="allowscriptaccess" value="always" />
      <param name="wmode" value="transparent"></param>
    </object>

     

    Isn't the variable inserted correct into the url string?

    Bjarne

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Dec 12, 2011 @ 12:50
    Chriztian Steinmeier
    1

    Hi Bjarne,

    When you set the variable like that, the processor is actually looking for an <tEdPJaq6t9s> element :-) - wrap some quotes around it to supply it as a string:

    <xsl:variable name="videoID" select="'tEdPJaq6t9s'" />

    /Chriztian 

  • Bjarne Fyrstenborg 1284 posts 4038 karma points MVP 8x c-trib
    Dec 12, 2011 @ 12:58
    Bjarne Fyrstenborg
    0

    Thanks Chriztian :)

    That was a quick fix..

    It works just fine now inside the Video tab here: http://sub.ak-security.dk/da/shop/lygter/led-lenser-p7.aspx

    Bjarne

Please Sign in or register to post replies

Write your reply to:

Draft