tags:

views:

118

answers:

2

I have an xml feed and I need to play an mp3 from the feed. I have set up the player

    <div class="musicplayer">
<div id="musicplayercontainer060251712481gbakw0201569t"></div>
<script type="text/javascript">
    var flashvars = {file:"music/betty.mp3",as:"0"};
    var params = {wmode: "transparent"};
    var attributes = {};
    swfobject.embedSWF("images/player.swf", "musicplayercontainer060251712481gbakw0201569t", "23", "23", "9.0.0","expressInstall.swf", flashvars, params, attributes);
</script></div>

and it works fine if i pass the mp3 directly but I have to pass it from the xml so I replaced the betty.mp3 with <xsl:value-of select="clipUrl"/> but it won't play. is there a syntax i need to use?

e.g.

var flashvars = {file:"<xsl:value-of select="clipUrl"/>",as:"0"};

thanks

A: 

it is just when I replace betty.mp3 so like

<div class="musicplayer">
<div id="musicplayercontainer060251712481gbakw0201569t"></div>
<script type="text/javascript">
    var flashvars = {file:"<xsl:value-of select="clipUrl"/>",as:"0"};
    var params = {wmode: "transparent"};
    var attributes = {};
    swfobject.embedSWF("images/player.swf", "musicplayercontainer060251712481gbakw0201569t", "23", "23", "9.0.0","expressInstall.swf", flashvars, params, attributes);
</script></div>
katie
Please edit you question with this detail and delete this "answer" because it isn't answer. Can I suggest you read the FAQ, SO is probably unlike other sites you may have used in the past.
AnthonyWJones
Can you try changing the double-quotes around clipUrl to single ones just to rule that out? Also, are you seeing any errors from the XSLT parser? What does the HTML code look like afterwards?
Olly Hodgson
Sorry silly me. It did work, but becuase the player was using a uique id it was picking up from a different track in the xml. I am now targeting the player with a unique ID. thanks for your help.
katie
A: 

Personally if you don't have any XHTML based expando hangups you could do this instead:-

<div class="musicplayer">
  <div id="musicplayercontainer060251712481gbakw0201569t"
      audioSrc="{clipUrl}"
  ></div>
  <script type="text/javascript">
    var elem = document.getElementById("musicplayercontainer060251712481gbakw0201569t");
    var flashvars = {file:elem.getAttribute("audioSrc"), as:"0"};
    var params = {wmode: "transparent"};
    var attributes = {};
    swfobject.embedSWF("images/player.swf", "musicplayercontainer060251712481gbakw0201569t", "23", "23", "9.0.0","expressInstall.swf", flashvars, params, attributes);
  </script>
</div>

This way you don't embedded xsl instructions in your script code where output encoding may be messing things up.

AnthonyWJones