Subject: [xsl] Remove element that all its descendants have no text nodes From: Israel Viente <israel.viente@xxxxxxxxx> Date: Thu, 11 Feb 2010 00:07:23 +0200 |
Hi, I want to remove span elements that have empty text nodes and no further descendants. In case the p has ONLY empty spans I want to remove it alltogether. Example: <p dir="rtl"><span id="textStyle10"></span></p> <p dir="rtl"><span id="textStyle10">Some text.</span> <span id="textStyle10"></span></p> <p dir="rtl"><span id="textStyle10"></span><sup>1</sup></p> <p dir="rtl"><span id="textStyle10"><br /><br /></span></p> Desired output: <p dir="rtl"><span id="textStyle10">Some text.</span> </p> <p dir="rtl"><sup>1</sup></p> <p dir="rtl"><span id="textStyle10"><br /><br /></span></p> In case it is too complicated I can live with such output (remove p that all its spans have empty text nodes): <p dir="rtl"><span id="textStyle10">Some text.</span> <span id="textStyle10"></span></p> <p dir="rtl"><span id="textStyle10"></span><sup>1</sup></p> <p dir="rtl"><span id="textStyle10"><br /><br /></span></p> I tried the following: <xsl:template match="p[span[normalize-space(.)='']]"/> but it removes the p even if only one span is empty. Any help would be appreciated. Thanks, Israel
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] finding out distinct node, Hermann Stamm-Wilbra | Thread | Re: [xsl] Remove element that all i, G. Ken Holman |
Re: [xsl] finding out distinct node, Hermann Stamm-Wilbra | Date | Re: [xsl] Remove element that all i, G. Ken Holman |
Month |