Just for fun, more general XSLT 2.0 solutions (can be optimized):
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="span[tokenize(@style,';')[ matches(.,'\p{Z}*font\-style\p{Z}*:\p{Z}*italic\p{Z}*') ]]"> <xsl:copy> <xsl:apply-templates select="@* except @style"/> <xsl:attribute name="style" select= "tokenize(@style,';')[not( matches(.,'\p{Z}*font\-style\p{Z}*:\p{Z}*italic\p{Z}*') )]" separator=";"/> <em> <xsl:apply-templates select="node()"/> </em> </xsl:copy> </xsl:template> </xsl:stylesheet>
Output:
<span style="color:#555555"><em>some text</em></span>
user357812
source share