simple XSLT template predicate rule

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi all,
I want to be able to strip out my XML elements that contain the text (Null) (e.g. <element>(Null)</element>)), along with any empty elements.
My current predicate is below...

<div style="color:Black;background-color:White; <pre>
<span style="color:Green; <!-- Copy all nodes that have text. -->
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; template <span style="color:Red; match<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; *[not(descendant::text()[normalize-space()]) and not(descendant-or-self::*/@*)]<span style="color:Black; " <span style="color:Red; mode<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; TransformationEmptyNodeRemovalPass<span style="color:Black; " <span style="color:Blue; />
[/code]

if I want to insert logic to also not process elements that contain the text (Null) how would i add the logic? I have tried many variations but I get no joy. Such as...

<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; template <span style="color:Red; match<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; *[not(descendant::text() = (Null)) and not(descendant::text()[normalize-space()]) and not(descendant-or-self::*/@*)]<span style="color:Black; " <span style="color:Red; mode<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; TransformationEmptyNodeRemovalPass<span style="color:Black; " <span style="color:Blue; />
[/code]

and help on this would be appreciated. Thanks.






<hr class="sig Tryst

View the full article
 
Back
Top