简体   繁体   English

Umbraco XSLT宏问题

[英]Umbraco XSLT macro issue

I copied an XSLT video player macro from an Umbraco 4.7.2 site into another Umbraco 4.0 site we have. 我将XSLT视频播放器宏从Umbraco 4.7.2站点复制到了另一个Umbraco 4.0站点。

The macros are identical but the copied macro isn't running in 4.0, it produces no HTML or errors with all macro parameters holding values. 宏是相同的,但是复制的宏不在4.0中运行,它不会产生HTML或所有宏参数均具有值的错误。

Are there some syntax differences between these two versions or am I making a mistake? 这两个版本之间在语法上有区别吗?还是我做错了? XSLT isn't my native tongue, I'm more of a Razor guy. XSLT不是我的母语,我更像是剃刀人。

Could someone point me toward the issue? 有人可以指出我的问题吗?

XSLT code: XSLT代码:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [
<!ENTITY nbsp "&#x00A0;">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" version="1.0" exclude-result-prefixes="msxml umbraco.library">
  <xsl:output method="xml" omit-xml-declaration="yes"/>
  <xsl:param name="currentPage"/>
  <!-- set up vars -->
  <xsl:variable name="vidToPlay" select="/macro/vidToPlay"/>
  <xsl:variable name="previewImage" select="/macro/previewImage"/>
  <!-- END set up vars -->
  <xsl:template match="/">
    <!-- start writing XSLT -->
    <xsl:if test="$vidToPlay != '' and $previewImage != '' ">
      <xsl:variable name="showMe" select="umbraco.library:GetMedia($vidToPlay/node/@id, 0)/data [@alias = 'umbracoFile']"/>
      <xsl:variable name="preview" select="umbraco.library:GetMedia($previewImage/node/@id, 0)/data [@alias = 'umbracoFile']"/>
      <video controls="" poster="{$preview}">
        <source src="{$showMe}" type="video/mp4"/>
        <object width="640" height="360" type="application/x-shockwave-flash" data="/media/12209/player.swf">
          <!-- Firefox uses the `data` attribute above, IE/Safari uses the param below -->
          <param name="movie" value="/media/12209/player.swf"/>
          <param name="flashvars" value="controlbar=over&amp;file={$showMe}"/>
        </object>
      </video>
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>

The XSLT displayed is from a previous Umbraco version, before the XML schema change. 在更改XML模式之前,显示的XSLT来自以前的Umbraco版本。

<xsl:variable name="showMe" select="umbraco.library:GetMedia($vidToPlay/node/@id, 0)/data [@alias = 'umbracoFile']"/>
<xsl:variable name="preview" select="umbraco.library:GetMedia($previewImage/node/@id, 0)/data [@alias = 'umbracoFile']"/>

These lines should be 这些行应该是

<xsl:variable name="showMe" select="umbraco.library:GetMedia($vidToPlay/node/@id, 0)/umbracoFile"/>
<xsl:variable name="preview" select="umbraco.library:GetMedia($previewImage/node/@id, 0)/umbracoFile"/>

More info on GetMedia from the Umbraco wiki: http://our.umbraco.org/wiki/reference/umbracolibrary/getmedia Umbraco Wiki上有关GetMedia的更多信息: http ://our.umbraco.org/wiki/reference/umbracolibrary/getmedia

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM