【问题标题】:XSL html5 embed video not workingXSL html5 嵌入视频不起作用
【发布时间】:2013-08-23 18:59:49
【问题描述】:

有人可以帮我吗?我是 xsl/xml 进程的新手,我不确定我做错了什么...... 我有这段代码可以生成一个包含视频的 html:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan" extension-element-prefixes="xalan" exclude-result-prefixes="xalan">

    <xsl:variable name="StyleSheet"><xsl:text>html</xsl:text></xsl:variable>
    <xsl:variable name="product" select="//...//someting..."/>
    <xsl:template match="/">
    <html>
     <head>
      <title><xsl:value-of select="$product"/></title>
       <BASE HREF="https://....com"/>
       <LINK REL="stylesheet" TYPE="text/css" HREF="/style/rbc_new.css">
       </LINK>
     </head>

     <body bgcolor="white">
       <DIV>
        <table width="670" border="0" bgcolor="#ffffff">
         <tr>
          <td>
    <!--
           This type of report is not available in HTML format. Please check the PDF version.
    -->
    VIDEO UPLOADED *:
          </td>
         </tr>

                                        <tr>
                                            <td valign="top" class="rbc_color1_font_10">

                                                <xsl:variable name="video" select="concat(some file)"/>
                                                <xsl:variable name="video2" select="other file">

 <!--  THIS IS FOR Html4 & older versions and this one works -->

    <object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" width="480" height="360" codebase="http://www.microsoft.com/Windows/MediaPlayer/">
    <param name="Filename" value="{$video}"/>
    <param name="AutoStart" value="false"/>
    <param name="ShowControls" value="true"/>
    <param name="BufferingTime" value="2"/>
    <param name="ShowStatusBar" value="true"/>
    <param name="AutoSize" value="true"/>
    <param name="InvokeURLs" value="false"/>
    <embed src="{$video}" type="application/x-mplayer2" autostart="0" enabled="1" showstatusbar="1" showdisplay="1" showcontrols="1" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" width="480" height="360"></embed>
    </object>  
    <!--this is for html5 and this one does not work -->
    <video width="320" height="240" controls>
       <source src="{$video}" type="video/mp4">
        Your browser does not support the video tag.
     </video> 
        </td>

我做错了什么?我应该把这样的 XSL 版本与 html5 一起使用(它有什么效果吗?)它仍然会运行 html4 类型吗??:

<xsl:output
     method="xml"
     doctype-system="about:legacy-compat"
     encoding="UTF-8"
     indent="yes" />

谢谢你。

【问题讨论】:

    标签: xml html xslt html5-video


    【解决方案1】:

    XSLT 样式表必须是格式良好的 XML,而这不是:

    <video width="320" height="240" controls>
    

    处理“无价值”HTML 属性的常用方法是设置controls="controls"。然而,因为这个没有在 HTML4 中定义,XSLT 序列化程序可能无法识别它,并且将输出controls="controls" 而不是简单的controls。希望浏览器会接受它作为等效项。

    【讨论】:

    • 如果你已经解决了这个问题,那么说明你是如何解决的会很有帮助,对于那些后来找到这个帖子的人来说。
    • 很抱歉没有回复,我在一些项目中被咳了出来。问题又出现在我打印视频的 JAVA 类中,我已经修复了一个错误。它与此无关...无论如何感谢您的帮助,是的,您的回答很好,再次感谢您的帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-03
    • 1970-01-01
    • 2013-02-12
    • 2016-07-02
    • 2011-12-21
    • 1970-01-01
    相关资源
    最近更新 更多