Reputation: 1020
I'have xml like follows,
<doc>
<p type="para">.<t/>JMS<s/>
<style type="italic">Bambulla</style>
<s/>2012-13, s. 65 (ad § 3)
</p>
</doc>
what I need is remove .
that places right after <p type="para">
. note that every time .
places between <p type="para">
and <t/>
.
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="p[@type='para']">
<p type="para">
<xsl:apply-templates/>
</p>
</xsl:template>
How can I expand above xsl to remove only that .
string ?
Upvotes: 0
Views: 539
Reputation: 167571
If you add <xsl:template match="p[@type='para']/node()[1][self::text() and . = '.' and following-sibling::node()[1][self::t[not(node())]]]"/>
then any first child node of a p[@type='para']
which is a text node with string value .
and is followed by an empty t
element would be deleted.
Upvotes: 1