Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Just spent the last hour to figure out why my "embed-youtube" xslt was breaking my page layout (hiding all HTML that came after the video embed code).
Then finally it struck me that it was because there was no data between the iframe start and end tag and xslt does not seem to like that :/
<iframe width="100" height="100"> 'empty space' </iframe>
So with a little work around i got i working:
<xsl:variable name="video" select="$currentPage/frontpageMedia"/>
<!-- start writing XSLT -->
<xsl:if test="$video != '' ">
<xsl:attribute name="src">http://www.youtube.com/embed/<xsl:value-of select="$video"/></xsl:attribute>
<xsl:comment/><!-- avoid empty tag value that breaks the html-->
$currentPage/frontpageMedia is a Singleline text field where the key for the youtube video is pasted into.
Hope it can help someone in a similar situation.
Have a nice day :-)
Umbraco version 4.7.2
Yes, you have to make sure, that the data in the container not is empty, otherwise the html unfortunately is self-closing and it might break the layout..
There are multiple ways to fix this.. e.g as you mention with inserting a <xsl:comment /> or you can force an empty space <xsl:text> </xsl:text> ... or you can change output to html:
Thanks for the xsl positing you did with youtube example, it was pretty useful. Thanks a ton :)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted