Reputation: 163
I want to use specific elements for tab spaces.
<char type="endNestedStyleHere"/>
) should be placed at the end of the show's title, which is marked by a space followed by one of the following codes: MVLSC, 16VLSC, MSC, 16VL, ML, MC, PGC, 16VL.Input :
<table>
<tr>
<td> noon Nothing But Trailers MVLSC.</td>
</tr>
<tr>
<td> 7.10 Between Worlds 16VLSC 2018 Thriller.</td>
</tr>
</table>
Output should be:
<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>
Tried code:
<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>
Upvotes: 0
Views: 103
Reputation: 117100
How about:
<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>
Upvotes: 1