如何将(.FDX / .FDXT)文件格式翻译成HTML?

时间:2016-09-26 12:11:01

标签: html xml

我正在使用Final Draft文件翻译电影脚本。文件类型基本上是XML文件,但扩展名是(.fdx& .fdxt)。

我想要实现的是,如何从(.fdx& .fdxt)文件中读取数据。

我正在尝试将.fdx和.fdxt文件转换为HTML格式,然后再将其转换回来。

2 个答案:

答案 0 :(得分:0)

在Windows资源管理器中将.fdxt的文件扩展名添加到.html(以便该文件在.fdxt.html中有效结束)。然后,您可以将文件导入到memoQ之类的CAT工具中并进行翻译。

答案 1 :(得分:0)

您可以使用 XSL 将 FinalDraft XML 转换为类似于普通脚本视图的内容(只需根据需要编辑 CSS)。

这是一个工作模板:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />
<xsl:template match="/">
<html> 
    <head>
        <style>
            div.general {text-align: left;font-family: "Courier New", Courier, monospace;margin-left: 5%;width: 80%;}
            div.scene {text-align: left;font-family: "Courier New", Courier, monospace;font-weight: bold;margin-left: 5%;width: 80%;}
            div.action {text-align: left;font-family: "Courier New", Courier, monospace;font-style: italic;margin-left: 10%;width: 80%;}
            div.character {text-align: left;font-family: "Courier New", Courier, monospace;font-weight: bold;text-transform: uppercase;text-decoration: underline;margin-left: 40%;width: 40%;}
            div.dialogue {text-align: left;font-family: "Courier New", Courier, monospace;margin-left: 20%;width: 60%;}
            div.parenthetical {text-align: left;font-family: "Courier New", Courier, monospace;font-style: italic;margin-left: 25%;width: 50%;}
            div.headerfooter {text-align: center;font-family: "Courier New", Courier, monospace;margin: 10%;width: 80%;}
            div.other {;}
            span.bold {font-weight: bold;}
            span.italic {font-style: italic;}
            span.underline {text-decoration: underline;}
            span.strikeout {text-decoration: line-through;}
            span.allcaps {text-transform: uppercase;}
        </style>
    </head>
    <body>
    <xsl:for-each select="//Content/Paragraph[@Type='General' or @Type='Scene Heading' or @Type='Action' or @Type='Character' or @Type='Dialogue' or @Type='Parenthetical'] | //HeaderAndFooter/Header/Paragraph | //HeaderAndFooter/Footer/Paragraph">
        <p>
        <xsl:choose>
            <xsl:when test="@Type = 'General'">
                <div class="general"><xsl:value-of select="normalize-space()" /></div>
            </xsl:when>
            <xsl:when test="@Type = 'Scene Heading'">
                <xsl:if test="SceneProperties/@Title != ''">
                    <div class="general"><xsl:value-of select="SceneProperties/@Title" /></div>
                </xsl:if>
                <xsl:if test="Text != ''">
                    <div class="scene"><xsl:value-of select="normalize-space()" /></div>
                </xsl:if>
            </xsl:when>
            <xsl:when test="@Type = 'Action'">
                <div class="action">
                <xsl:for-each select="./Text">
                    <span>
                        <xsl:attribute name="class">
                            <xsl:if test="contains(@Style, 'Bold')">bold </xsl:if>
                            <xsl:if test="contains(@Style, 'Italic')">italic </xsl:if>
                            <xsl:if test="contains(@Style, 'Underline')">underline </xsl:if>
                            <xsl:if test="contains(@Style, 'Strikeout')">strikeout </xsl:if>
                            <xsl:if test="contains(@Style, 'AllCaps')">allcaps </xsl:if>
                        </xsl:attribute>
                        <xsl:value-of select="node()" />
                    </span>
                </xsl:for-each>
                </div>
            </xsl:when>
            <xsl:when test="@Type = 'Character'">
                <div class="character"><xsl:value-of select="normalize-space()" /></div>
            </xsl:when>
            <xsl:when test="@Type = 'Dialogue'">
                <div class="dialogue">
                <xsl:for-each select="./Text">
                    <span>
                        <xsl:attribute name="class">
                            <xsl:if test="contains(@Style, 'Bold')">bold </xsl:if>
                            <xsl:if test="contains(@Style, 'Italic')">italic </xsl:if>
                            <xsl:if test="contains(@Style, 'Underline')">underline </xsl:if>
                            <xsl:if test="contains(@Style, 'Strikeout')">strikeout </xsl:if>
                            <xsl:if test="contains(@Style, 'AllCaps')">allcaps </xsl:if>
                        </xsl:attribute>
                        <xsl:value-of select="node()" />
                    </span>
                </xsl:for-each>
                </div>
            </xsl:when>
            <xsl:when test="@Type = 'Parenthetical'">
                <div class="parenthetical">
                <xsl:for-each select="./Text">
                    <span>
                        <xsl:attribute name="class">
                            <xsl:if test="contains(@Style, 'Bold')">bold </xsl:if>
                            <xsl:if test="contains(@Style, 'Italic')">allcaps </xsl:if>
                            <xsl:if test="contains(@Style, 'Underline')">underline </xsl:if>
                            <xsl:if test="contains(@Style, 'Strikeout')">strikeout </xsl:if>
                            <xsl:if test="contains(@Style, 'AllCaps')">allcaps </xsl:if>
                        </xsl:attribute>
                        <xsl:value-of select="node()" />
                    </span>
                </xsl:for-each>
                </div>
            </xsl:when>
            <xsl:when test="Text != ''">
                <div class="headerfooter">(<xsl:value-of select ="local-name(..)"/>:) <xsl:value-of select="normalize-space()" /></div>
            </xsl:when>
            <xsl:otherwise>
                <div class="other">(<xsl:value-of select ="local-name()"/>:) <xsl:value-of select="normalize-space()" /></div>
            </xsl:otherwise>
        </xsl:choose> 
        </p>
    </xsl:for-each>
    </body>
</html>
</xsl:template>
</xsl:stylesheet>

在 Memsource 或 memoQ 等 CAT 工具中,您可以使用此 XSL 来创建预览。 在 FDX 的 memoQ 导入过滤器下方,以防万一:

<MemoQResource ResourceType="FilterConfigs" Version="1.0">
  <Resource>
    <Guid>037f5266-55cc-468f-9874-72dda6ee9e93</Guid>
    <FileName />
    <Name>FDX filter</Name>
    <Description />
    <FilterName>MemoQ.DocConverters.XML.XMLConverter</FilterName>
    <AdditionalPropertyExtensions>
      <Item>
        <SubItem>FinalDraft</SubItem>
      </Item>
    </AdditionalPropertyExtensions>
  </Resource>
</MemoQResource>
<MemoQFilterConfiguration filtername="XML Filter" version="V2" name="FDX filter">
  <SampleFileList>
    <SampleFile path="sample.fdx" encoding="65001" />
  </SampleFileList>
  <SampleDTDPath value="" isdtd="yes" />
  <GeneralOptions logwarnings="yes" importcomments="no" commenthandling="SegmentBreak" detectencoding="yes" inputencodingkey="65001" outputencodingkey="-1" normalizews="no" observexmlspace="yes" restoreentities="yes" savenumericcharreferences="yes" assocdtd="" roottagname="FinalDraft" treatnewlinesassegmentbreak="no" importpisasinlinetags="no" hasprocessinginstructionattributes="no" writebom="yes" xmltype="normal" />
  <HandledTags>
    <Tag name="Paragraph" inline="no" placeholder="no" tagrequired="Normal" iscontxt="no" iscomment="no" ispreviewurl="no" ispreviewid="no" commentsiblingsas="OnlyFollowing" contextsiblingsas="OnlyFollowing" previewidsiblingsas="OnlyFollowing" isstructcontext="no" nontranslated="no" translationtypeseverity="Week" wshandling="Inherit" highlight="NoHighlight" breaksegmentaftertag="none" treatassegmentpartbreak="no" hidetranslatableattsindynamicnontranscase="yes" breaksegmentatnewlineiftagiswspreserve="no">
      <Attributes>
        <Attribute name="Type" translatable="no" required="no" filtered="no" contentspecific="yes" context="None" comment="Content" ispreviewurl="no" previewid="None" structcontext="None" nontranstype="None" translationtypeseverity="Week" attributemissingtranslatabilityhandling="TreatMissingValueAsPartOfList">
          <NonTransSpecificValues>
            <NonTransSpecificValue value="Action" />
            <NonTransSpecificValue value="Character" />
            <NonTransSpecificValue value="Dialogue" />
            <NonTransSpecificValue value="General" />
            <NonTransSpecificValue value="Parenthetical" />
            <NonTransSpecificValue value="Scene Heading" />
            <NonTransSpecificValue value="Shot" />
            <NonTransSpecificValue value="Transition" />
          </NonTransSpecificValues>
          <TranslatabilityConditions>
          </TranslatabilityConditions>
        </Attribute>
      </Attributes>
    </Tag>
    <Tag name="SceneProperties" inline="no" placeholder="no" tagrequired="Normal" iscontxt="no" iscomment="no" ispreviewurl="no" ispreviewid="no" commentsiblingsas="OnlyFollowing" contextsiblingsas="OnlyFollowing" previewidsiblingsas="OnlyFollowing" isstructcontext="no" nontranslated="no" translationtypeseverity="Week" wshandling="Inherit" highlight="NoHighlight" breaksegmentaftertag="none" treatassegmentpartbreak="no" hidetranslatableattsindynamicnontranscase="yes" breaksegmentatnewlineiftagiswspreserve="no">
      <Attributes>
        <Attribute name="Title" translatable="yes" required="no" filtered="no" contentspecific="yes" context="None" comment="None" ispreviewurl="no" previewid="None" structcontext="None" nontranstype="None" translationtypeseverity="Week" attributemissingtranslatabilityhandling="TreatAsSpecialValue">
          <NonTransSpecificValues>
          </NonTransSpecificValues>
          <TranslatabilityConditions>
          </TranslatabilityConditions>
        </Attribute>
      </Attributes>
    </Tag>
    <Tag name="Text" inline="no" placeholder="no" tagrequired="Normal" iscontxt="no" iscomment="no" ispreviewurl="no" ispreviewid="no" commentsiblingsas="OnlyFollowing" contextsiblingsas="OnlyFollowing" previewidsiblingsas="OnlyFollowing" isstructcontext="no" nontranslated="no" translationtypeseverity="Week" wshandling="Inherit" highlight="NoHighlight" breaksegmentaftertag="none" treatassegmentpartbreak="no" hidetranslatableattsindynamicnontranscase="yes" breaksegmentatnewlineiftagiswspreserve="no">
      <Attributes>
        <Attribute name="Style" translatable="no" required="no" filtered="no" contentspecific="yes" context="None" comment="Content" ispreviewurl="no" previewid="None" structcontext="None" nontranstype="None" translationtypeseverity="Week" attributemissingtranslatabilityhandling="TreatAsSpecialValue">
          <NonTransSpecificValues>
          </NonTransSpecificValues>
          <TranslatabilityConditions>
          </TranslatabilityConditions>
        </Attribute>
      </Attributes>
    </Tag>
    <Tag name="Character" inline="no" placeholder="no" tagrequired="Normal" iscontxt="no" iscomment="no" ispreviewurl="no" ispreviewid="no" commentsiblingsas="OnlyFollowing" contextsiblingsas="OnlyFollowing" previewidsiblingsas="OnlyFollowing" isstructcontext="no" nontranslated="yes" translationtypeseverity="Week" wshandling="Inherit" highlight="NoHighlight" breaksegmentaftertag="none" treatassegmentpartbreak="no" hidetranslatableattsindynamicnontranscase="yes" breaksegmentatnewlineiftagiswspreserve="no">
      <Attributes>
      </Attributes>
    </Tag>
    <Tag name="Extension" inline="no" placeholder="no" tagrequired="Normal" iscontxt="no" iscomment="no" ispreviewurl="no" ispreviewid="no" commentsiblingsas="OnlyFollowing" contextsiblingsas="OnlyFollowing" previewidsiblingsas="OnlyFollowing" isstructcontext="no" nontranslated="yes" translationtypeseverity="Week" wshandling="Inherit" highlight="NoHighlight" breaksegmentaftertag="none" treatassegmentpartbreak="no" hidetranslatableattsindynamicnontranscase="yes" breaksegmentatnewlineiftagiswspreserve="no">
      <Attributes>
      </Attributes>
    </Tag>
    <Tag name="SceneIntro" inline="no" placeholder="no" tagrequired="Normal" iscontxt="no" iscomment="no" ispreviewurl="no" ispreviewid="no" commentsiblingsas="OnlyFollowing" contextsiblingsas="OnlyFollowing" previewidsiblingsas="OnlyFollowing" isstructcontext="no" nontranslated="yes" translationtypeseverity="Week" wshandling="Inherit" highlight="NoHighlight" breaksegmentaftertag="none" treatassegmentpartbreak="no" hidetranslatableattsindynamicnontranscase="yes" breaksegmentatnewlineiftagiswspreserve="no">
      <Attributes>
      </Attributes>
    </Tag>
    <Tag name="TimeOfDay" inline="no" placeholder="no" tagrequired="Normal" iscontxt="no" iscomment="no" ispreviewurl="no" ispreviewid="no" commentsiblingsas="OnlyFollowing" contextsiblingsas="OnlyFollowing" previewidsiblingsas="OnlyFollowing" isstructcontext="no" nontranslated="yes" translationtypeseverity="Week" wshandling="Inherit" highlight="NoHighlight" breaksegmentaftertag="none" treatassegmentpartbreak="no" hidetranslatableattsindynamicnontranscase="yes" breaksegmentatnewlineiftagiswspreserve="no">
      <Attributes>
      </Attributes>
    </Tag>
    <Tag name="DialogueBreaks" inline="no" placeholder="no" tagrequired="Normal" iscontxt="no" iscomment="no" ispreviewurl="no" ispreviewid="no" commentsiblingsas="OnlyFollowing" contextsiblingsas="OnlyFollowing" previewidsiblingsas="OnlyFollowing" isstructcontext="no" nontranslated="yes" translationtypeseverity="Week" wshandling="Inherit" highlight="NoHighlight" breaksegmentaftertag="none" treatassegmentpartbreak="no" hidetranslatableattsindynamicnontranscase="yes" breaksegmentatnewlineiftagiswspreserve="no">
      <Attributes>
        <Attribute name="DialogueTop" translatable="no" required="no" filtered="no" contentspecific="yes" context="None" comment="None" ispreviewurl="no" previewid="None" structcontext="None" nontranstype="None" translationtypeseverity="Week" attributemissingtranslatabilityhandling="TreatAsSpecialValue">
          <NonTransSpecificValues>
          </NonTransSpecificValues>
          <TranslatabilityConditions>
          </TranslatabilityConditions>
        </Attribute>
        <Attribute name="DialogueBottom" translatable="no" required="no" filtered="no" contentspecific="yes" context="None" comment="None" ispreviewurl="no" previewid="None" structcontext="None" nontranstype="None" translationtypeseverity="Week" attributemissingtranslatabilityhandling="TreatAsSpecialValue">
          <NonTransSpecificValues>
          </NonTransSpecificValues>
          <TranslatabilityConditions>
          </TranslatabilityConditions>
        </Attribute>
      </Attributes>
    </Tag>
    <Tag name="SceneBreaks" inline="no" placeholder="no" tagrequired="Normal" iscontxt="no" iscomment="no" ispreviewurl="no" ispreviewid="no" commentsiblingsas="OnlyFollowing" contextsiblingsas="OnlyFollowing" previewidsiblingsas="OnlyFollowing" isstructcontext="no" nontranslated="yes" translationtypeseverity="Week" wshandling="Inherit" highlight="NoHighlight" breaksegmentaftertag="none" treatassegmentpartbreak="no" hidetranslatableattsindynamicnontranscase="yes" breaksegmentatnewlineiftagiswspreserve="no">
      <Attributes>
        <Attribute name="SceneTop" translatable="no" required="no" filtered="no" contentspecific="yes" context="None" comment="None" ispreviewurl="no" previewid="None" structcontext="None" nontranstype="None" translationtypeseverity="Week" attributemissingtranslatabilityhandling="TreatAsSpecialValue">
          <NonTransSpecificValues>
          </NonTransSpecificValues>
          <TranslatabilityConditions>
          </TranslatabilityConditions>
        </Attribute>
        <Attribute name="SceneBottom" translatable="no" required="no" filtered="no" contentspecific="yes" context="None" comment="None" ispreviewurl="no" previewid="None" structcontext="None" nontranstype="None" translationtypeseverity="Week" attributemissingtranslatabilityhandling="TreatAsSpecialValue">
          <NonTransSpecificValues>
          </NonTransSpecificValues>
          <TranslatabilityConditions>
          </TranslatabilityConditions>
        </Attribute>
      </Attributes>
    </Tag>
    <Tag name="Member" inline="no" placeholder="no" tagrequired="Normal" iscontxt="no" iscomment="no" ispreviewurl="no" ispreviewid="no" commentsiblingsas="OnlyFollowing" contextsiblingsas="OnlyFollowing" previewidsiblingsas="OnlyFollowing" isstructcontext="no" nontranslated="yes" translationtypeseverity="Week" wshandling="Inherit" highlight="NoHighlight" breaksegmentaftertag="none" treatassegmentpartbreak="no" hidetranslatableattsindynamicnontranscase="yes" breaksegmentatnewlineiftagiswspreserve="no">
      <Attributes>
        <Attribute name="Character" translatable="no" required="no" filtered="no" contentspecific="yes" context="None" comment="None" ispreviewurl="no" previewid="None" structcontext="None" nontranstype="None" translationtypeseverity="Week" attributemissingtranslatabilityhandling="TreatAsSpecialValue">
          <NonTransSpecificValues>
          </NonTransSpecificValues>
          <TranslatabilityConditions>
          </TranslatabilityConditions>
        </Attribute>
      </Attributes>
    </Tag>
    <Tag name="Location" inline="no" placeholder="no" tagrequired="Normal" iscontxt="no" iscomment="no" ispreviewurl="no" ispreviewid="no" commentsiblingsas="OnlyFollowing" contextsiblingsas="OnlyFollowing" previewidsiblingsas="OnlyFollowing" isstructcontext="no" nontranslated="yes" translationtypeseverity="Week" wshandling="Inherit" highlight="NoHighlight" breaksegmentaftertag="none" treatassegmentpartbreak="no" hidetranslatableattsindynamicnontranscase="yes" breaksegmentatnewlineiftagiswspreserve="no">
      <Attributes>
      </Attributes>
    </Tag>
    <Tag name="Transition" inline="no" placeholder="no" tagrequired="Normal" iscontxt="no" iscomment="no" ispreviewurl="no" ispreviewid="no" commentsiblingsas="OnlyFollowing" contextsiblingsas="OnlyFollowing" previewidsiblingsas="OnlyFollowing" isstructcontext="no" nontranslated="yes" translationtypeseverity="Week" wshandling="Inherit" highlight="NoHighlight" breaksegmentaftertag="none" treatassegmentpartbreak="no" hidetranslatableattsindynamicnontranscase="yes" breaksegmentatnewlineiftagiswspreserve="no">
      <Attributes>
      </Attributes>
    </Tag>
  </HandledTags>
  <EntityGroupes>
    <EntityGroupe value="XMLPredefined" />
  </EntityGroupes>
  <CustomEntities>
  </CustomEntities>
  <ImportedEntities>
  </ImportedEntities>
  <XsltData originalfilepath="fdx.xslt" originalfilesubdirnumber="0">UEsDBBQAAAAIAHiDQlLB35eotQMAAMURAAAKAAAAZmR4KysueHNsdO1Y3W7bNhS+ToG+AyegcALEZtK1w6LIbrIMawsUQ4BkwIBhF4x0LBGjSIGio2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