2

有人能帮我吗 ?我是 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" />

提前谢谢你。

4

1 回答 1

0

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

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

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

于 2013-08-21T18:16:18.937 回答