xml - Check the node is present or not in xslt -


i new xslt, though manage work on it. struck 1 case need expert. trying finding node exists or not. search same question, in didn't expected answer. having node, mainnode->subnode1->subnode2->sunnode3. if checking below

<xsl:if test= "not(//mainnode/subnode1/subnode2/sunnode3)"> 

which working, if same converts in variable, below

<xsl:if test= "not(//mainnode/$var1/$var2/sunnode3)"> 

where, var1 = subnode1, var2 = subnode2

why not working. can't use variable in path searching. if not solution this.

you can't construct path step dynamically using variables. can use variable filter element name, example :

<xsl:if test= "not(//mainnode/*[name()=$var1]/*[name()=$var2]/sunnode3)"> 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -