Xslt 对选项卡空间使用特定元素

Xslt 对选项卡空间使用特定元素,xslt,Xslt,我想为选项卡空间使用特定元素 注意:结尾嵌套样式字符()应放在节目标题的末尾,该字符由空格标记,后跟以下代码之一:MVLSC、16VLSC、MSC、16VL、ML、MC、PGC、16VL 输入: <table> <tr> <td> noon Nothing But Trailers MVLSC.</td> </tr> <tr> <td> 7.10 Betw

我想为选项卡空间使用特定元素

  • 注意:结尾嵌套样式字符(
    )应放在节目标题的末尾,该字符由空格标记,后跟以下代码之一:MVLSC、16VLSC、MSC、16VL、ML、MC、PGC、16VL
输入:

<table>
  <tr>
      <td>    noon   Nothing But Trailers MVLSC.</td>
  </tr>
  <tr>
      <td>   7.10   Between Worlds 16VLSC 2018 Thriller.</td>
  </tr>
</table>

中午,除了MVLSC什么都没有。
7.10世界间16VLSC 2018惊悚片。
输出应为:

<p type="Entry"><t/>noon<t/>Nothing But Trailers<char type="endNestedStyleHere"/> MVLSC.</p>

<p type="Entry"><t/>7.10<t/>Between Worlds<char type="endNestedStyleHere"/> 16VLSC 2018 Thriller.</p>

MVLSC之外没有任何东西

7.10世界间16VLSC 2018惊悚片

试用代码:

<xsl:template match="td[matches(.,'^\t*[0-9].*|\t*noon')]">
    <p type="Entry">
        <xsl:apply-templates/>
    <p>
</xsl:template>

<xsl:template match="td/text()">
    <xsl:if test="matches(.,'\t')">
        <t/>
    </xsl:if>
</xsl:template>

那么:

<xsl:template match="td">
    <p type="Entry">
        <xsl:analyze-string select="." regex="\t">
            <xsl:matching-substring>
                <t/>
            </xsl:matching-substring>
            <xsl:non-matching-substring>
                <xsl:analyze-string select="." regex=" (MVLSC|16VLSC|MSC|16VL|ML|MC|PGC)">
                    <xsl:matching-substring>
                        <char type="endNestedStyleHere"/>
                        <xsl:value-of select="." />
                    </xsl:matching-substring>
                    <xsl:non-matching-substring>
                        <xsl:value-of select="." />
                    </xsl:non-matching-substring>
                </xsl:analyze-string>                    
            </xsl:non-matching-substring>
        </xsl:analyze-string>                    
    </p>
</xsl:template>