That's because (I bet) they end up with the same ID - and IDs must be unique on a page.
The generate-id() function you're using guarantees that in a single XML document, you won't get any duplicates, but they way it's used here, it actually ends up being called for what is essentially the same node over and over again.
To fix it, use the node's @id attribute instead, like this (IDs are also required to start with a non-digit character):
<xsl:attribute> (and its cousin <xsl:element>) are really meant for when you need to conditionally add an attribute/element, or when you need to take its name from a variable or similar.
The a + div can be much easier created (and subsequently read the day after) if you use curly braces (or "Attribute Value Templates" as they're officially called) for the attributes:
Thanks Chriztian! It works now. I could use some more help though. I have created a parameter in my macro and assigned the variable to the player controls like this: (so I could have one play and all other not auto play)
This seems to be because you're starting to get confused whether you're in XSLT or in JavaScript - happens a lot when you generate JavaScript like this :-)
I can only recommend getting your JavaScript out in a separate file - and then just render some classes or data-attributes on the HTML for the JS to target. Makes it so much easier to maintain.
I am getting an error on this line: , Also, I believe I need the value of select for autoplay to be converted to a string instead of a boolean that is outputted from the parameter. Correct? How would I do this?
Error occured
Error in XSLT at line 48, char 18 46: <script type="text/javascript"> 47: 48: >>> var autoplay = "<xsl:value-of select='$autoPlay' />"; <<< 49: var videoid = "<xsl:value-of select='$videoid' />"; 50: <![CDATA[
Have you got the casing right for the $autoplay variable? In your first example it's all lowercase (except for the JavaScript key) - the erroneous code use the pascalCased version...
XSLT will always convert to a string when using value-of - but doesn't the autoPlay key in JavaScript expect a JavaScript boolean? Like this:
clip: { autoPlay: true } // not autoPlay: "true" right?
How is your /macro/autoplay parameter set up? Is it a text or a boolean?
You were right it was my variable, Sorry. Also, my parameter is set as a boolean, but I have seen it return a 1 or 0 for the variable within the page and I thought it would have to be true or false.
Edit:
Just tried it out again. It autoplays both videos and the output in the code is showing a autoPlay = "1" and autoPlay = 0" for the other.
Edit:
Tried changing the macro to "text". It still plays both. Confusing. Any suggestions?
Thanks for the help! It's working!!! (after removing the quotes from the value-of-select). Did you have any ideas as to why when the autoHide is enabled and it moves off the movie to hide, it leves a black bar underneath the movie?
Multiple Flowplayers on the same page
I have a problem with a page with more than one Flowplayer on it here. It only displays the first video on the page.
https://edit-wwwprep.rose-hulman.edu/admissions-financial-aid/get-to-know-rose-hulman.aspx
Here is my xslt:
Hi Steve,
That's because (I bet) they end up with the same ID - and IDs must be unique on a page.
The generate-id() function you're using guarantees that in a single XML document, you won't get any duplicates, but they way it's used here, it actually ends up being called for what is essentially the same node over and over again.
To fix it, use the node's @id attribute instead, like this (IDs are also required to start with a non-digit character):
Let me know if it doesn't work,
/Chriztian
Another thing:
<xsl:attribute> (and its cousin <xsl:element>) are really meant for when you need to conditionally add an attribute/element, or when you need to take its name from a variable or similar.
The a + div can be much easier created (and subsequently read the day after) if you use curly braces (or "Attribute Value Templates" as they're officially called) for the attributes:
/Chriztian
Thanks Chriztian! It works now. I could use some more help though. I have created a parameter in my macro and assigned the variable to the player controls like this: (so I could have one play and all other not auto play)
Hi Steve,
This seems to be because you're starting to get confused whether you're in XSLT or in JavaScript - happens a lot when you generate JavaScript like this :-)
Try this:
I can only recommend getting your JavaScript out in a separate file - and then just render some classes or data-attributes on the HTML for the JS to target. Makes it so much easier to maintain.
/Chriztian
Chrizitian,
I am getting an error on this line: , Also, I believe I need the value of select for autoplay to be converted to a string instead of a boolean that is outputted from the parameter. Correct? How would I do this?
Error occured
Error in XSLT at line 48, char 18
46: <script type="text/javascript">
47:
48: >>> var autoplay = "<xsl:value-of select='$autoPlay' />"; <<<
49: var videoid = "<xsl:value-of select='$videoid' />";
50: <![CDATA[
Hi Steve,
Have you got the casing right for the $autoplay variable? In your first example it's all lowercase (except for the JavaScript key) - the erroneous code use the pascalCased version...
XSLT will always convert to a string when using value-of - but doesn't the autoPlay key in JavaScript expect a JavaScript boolean? Like this:
How is your /macro/autoplay parameter set up? Is it a text or a boolean?
/Chriztian
You were right it was my variable, Sorry. Also, my parameter is set as a boolean, but I have seen it return a 1 or 0 for the variable within the page and I thought it would have to be true or false.
Edit:
Just tried it out again. It autoplays both videos and the output in the code is showing a autoPlay = "1" and autoPlay = 0" for the other.
Edit:
Tried changing the macro to "text". It still plays both. Confusing. Any suggestions?
Below is the browser output:
Hi Steve,
Okay - so do you get any other detailes in the error message? Maybe the variable is out of scope?
To get the word true (or false) when outputting the variable, just define it using the boolean() function, e.g.:
Then you'll get true/false when it's converted by the value-of instruction.
/Chriztian
Great,
Regarding the "1", "0", "true" & "false" thing:
Drop the quotes - in JavaScript, Boolean("0") returns true - because it's a non-empty string.
So like this:
/Chriztian
Chriztian,
Thanks for the help! It's working!!! (after removing the quotes from the value-of-select). Did you have any ideas as to why when the autoHide is enabled and it moves off the movie to hide, it leves a black bar underneath the movie?
Example:
http://www.rose-hulman.edu/admissions-financial-aid/get-to-know-rose-hulman.aspx
is working on a reply...