0

编辑以包含其他信息。

我正在使用 Telestream Vantage 将 XML 转换为 Telestream 所称的元数据标签。

简单的方法如下:

  1. 在 Vantage 管理控制台中构建您的元数据标签集
  2. 将元数据标签集导出为 XML
  3. 从 XML 创建一个 XSL,它将从提供的 XML 中“剥离”值并填充标签集的字段。

我有一个由 FFProbe 生成的 xml,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<ffprobe:ffprobe xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:ffprobe='http://www.ffmpeg.org/schema/ffprobe' xsi:schemaLocation='http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd'>
<programs>
</programs>

<streams>
    <stream index="1" channels="1"/>
    <stream index="2" channels="1"/>
    <stream index="3" channels="1"/>
    <stream index="4" channels="1"/>
    <stream index="5" channels="1"/>
    <stream index="6" channels="1"/>
    <stream index="7" channels="1"/>
    <stream index="8" channels="1"/>
    <stream index="9" channels="1"/>
    <stream index="10" channels="1"/>
    <stream index="11" channels="1"/>
    <stream index="12" channels="1"/>
    <stream index="13" channels="1"/>
    <stream index="14" channels="1"/>
    <stream index="15" channels="1"/>
    <stream index="16" channels="1"/>
    <stream index="17" channels="1"/>
    <stream index="18" channels="1"/>
    <stream index="19" channels="1"/>
    <stream index="20" channels="1"/>
    <stream index="21" channels="1"/>
    <stream index="22" channels="1"/>
    <stream index="23" channels="1"/>
    <stream index="24" channels="1"/>
    <stream index="25" channels="1"/>
    <stream index="26" channels="1"/>
    <stream index="27" channels="1"/>
    <stream index="28" channels="1"/>
    <stream index="29" channels="1"/>
    <stream index="30" channels="1"/>
    <stream index="31" channels="1"/>
    <stream index="32" channels="1"/>
    <stream index="33" channels="1"/>
    <stream index="34" channels="1"/>
    <stream index="35" channels="1"/>
    <stream index="36" channels="1"/>
    <stream index="37" channels="1"/>
    <stream index="38" channels="1"/>
    <stream index="39" channels="1"/>
    <stream index="40" channels="1"/>
</streams>

我正在尝试使用以下语句从每一行中提取“通道”属性:

        <soa:Parameter type="int32" identifier="0c000188-c401-4b99-91dc-8e15ebcb7981" bindable="True" name="Stream 01" enabled="true" disableable="false" optionseditable="false" row="-1" column="-1" columnspan="1">
            <xsl:value-of select="default:ffprobe/default:streams[1]/default:stream[1]/@channels"/>
        </soa:Parameter>

如您所见,我正在查看的是“选择的价值”部分。对于每个后续块,我增加“流”参考:

<xsl:value-of select="default:ffprobe/default:streams[1]/default:stream[n]/@channels"/>

然后我运行一个 Vantage 工作流,它将一个 XML 文件作为附件输入,然后使用样式表和目标元数据标签集应用“转换”。

在我查看元数据标签集的地方,我的所有值都是 0,而不是根据导入的 XML 文件的 1。我的 XSL 技能非常缺乏,但任何帮助将不胜感激。

4

2 回答 2

0

通过 W3C 教程和一些试验和错误,以下语句有效:

<xsl:value-of select="ffprobe/streams/stream[n]/@channels" />

我还更改了 ffprobe 命令字符串:

-print_format xml=fully_qualified=1

这将 ffprobe 输出的 xml 更改为:

<?xml version="1.0" encoding="UTF-8"?>
<ffprobe>
    <programs>
    </programs>

    <streams>
        <stream index="1" channels="2"/>
        <stream index="2" channels="4"/>
        ...
    </streams>
</ffprobe>
于 2015-10-06T11:11:58.520 回答
-1

尝试以下 xsl 语句

<xsl:for-each select="/streams/stream">
<xsl:value-of select="/streams/stream/@channels"/>
</xsl:for-each>
于 2015-10-02T13:20:33.550 回答