我正在为一个网站做一个快速更新,但xslt不是我的事情,而且似乎是代码i代码查看生成的源代码失败 - 包含以下内容:
当前代码:
<?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>
生成的来源: (因为你可以看到它破坏了代码并且没有关闭然后显示{$ tags})我缺少什么?
<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>
答案 0 :(得分:0)
AVT (Attribute Value Template) convention in XSLT 仅针对属性值定义 - 正如此功能的名称所清楚地说明的那样。
作为文本节点一部分的花括号内的表达式不会被评估。需要使用<xsl:value-of>
指令。
<强>解决方案强>:
<强>替换强>:
url: '{$videoID}',
<强>与强>:
url: '<xsl:value-of select="$videoID"/>',
同样替换:
captionUrl: '{$srtID}'
<强>与强>
captionUrl: '<xsl:value-of select="$srtID"/>'