im doing a quick update for a site but xslt is not my thing and it seems to be failing with the code i code looking at the generated source – have included both below:
current code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:if test="string-length($currentPage/mp4videoLinkId) > 0">
<xsl:variable name="videoID" select="$currentPage/mp4videoLinkId" />
<xsl:variable name="srtID" select="$currentPage/mp4videoSRTId" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="flowplayer-3.2.6.min.js"></script>
<script src="flowplayer.ipad-3.2.2.min.js"></script>
<!-- player container-->
<a href="{$videoID}" style="display:block;width:473px;height:310px;" id="ipad"></a>
<script type="text/javascript">
$f("ipad", "flowplayer-3.2.7.swf",{
clip: {
autoPlay: false,
url: '{$videoID}',
// this is the Timed Text file with captions info
captionUrl: '{$srtID}'
},
plugins: {
captions: {
url: 'flowplayer.captions-3.2.3.swf',
// pointer to a content plugin (see below)
captionTarget: 'content'
},
// configure a content plugin to look good for our purpose
content: {
url:'flowplayer.content-3.2.0.swf',
bottom: 25,
width: '80%',
height:40,
backgroundColor: 'transparent',
backgroundGradient: 'none',
borderRadius: 4,
border: 0,
textDecoration: 'outline',
style: {
body: {
fontSize: 14,
fontFamily: 'Arial',
textAlign: 'center',
color: '#ffffff'
}
}
}
}
}).ipad();
</script>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
generated source:
(as you can see it breaking the code and not closing and then showing the {$tags}) what am i missing?
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" /><script src="flowplayer-3.2.6.min.js" /><script src="flowplayer.ipad-3.2.2.min.js" /><a href="mp4/assist-mi-car-parking.mp4" style="display:block;width:473px;height:310px;" id="ipad" /><script type="text/javascript">
$f("ipad", "flowplayer-3.2.7.swf",{
clip: {
autoPlay: false,
url: '{$videoID}',
// this is the Timed Text file with captions info
captionUrl: '{$srtID}'
},
plugins: {
captions: {
url: 'flowplayer.captions-3.2.3.swf',
// pointer to a content plugin (see below)
captionTarget: 'content'
},
// configure a content plugin to look good for our purpose
content: {
url:'flowplayer.content-3.2.0.swf',
bottom: 25,
width: '80%',
height:40,
backgroundColor: 'transparent',
backgroundGradient: 'none',
borderRadius: 4,
border: 0,
textDecoration: 'outline',
style: {
body: {
fontSize: 14,
fontFamily: 'Arial',
textAlign: 'center',
color: '#ffffff'
}
}
}
}
}).ipad();
</script>
The AVT (Attribute Value Template) convention in XSLT is defined only for attribute values — as the name of this feature clearly says.
Expressions inside curly braces that are part of a text node are not evaluated. One needs to use the
<xsl:value-of>instruction.Solution:
Replace:
with:
Similarly replace:
with: