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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -