XSLT text for certain child XML -


is possible test of xml not content , attributes belonges xml node?

for example:

<a>    <node/>    <node>       <node attr="attr1">          <d>test</d>       </node>     </node>    <node>       <c attr="attr2">          <d>test</d>       </c>    </node> </a> 

here need select <node> nodes child content

<node>    <c attr="attr1">       <d>test</d>    </c> </node> 

node[c[@attr = 'attr1'][d = 'test']] 

would select nodes contain at least content, you'd have add further constraints if want only content, e.g.

node[count(@*) = 0][count(node()) = 1]   [c[count(@*) = 1][count(node()) = 1][@attr = 'attr1'][d[. = 'test'][not(*)]] 

(this assumes stylesheet has <xsl:strip-space elements="*"/> whitespace-only text nodes can ignored)


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -