Advance thanks for those who will reply bcoz i google it lot but no luck & i am also new in XSL.
Provided XML
<Parameterdef>
<Anode>
<Anodeid>1</Anodeid>
</Anode>
<Bnode>
<Bnodeid>2</Bnodeid>
</Bnode>
<ParameterVisualization>
<ParameterDefinition>
<ParameterSection>Anode</ParameterSection>
<Parameter>Anodeid</Parameter>
</ParameterDefinition>
<ParameterDefinition>
<ParameterSection>Bnode</ParameterSection>
<Parameter>Bnodeid</Parameter>
</ParameterDefinition>
<ParameterDefinition>
<ParameterSection>Cnode</ParameterSection>
<Parameter>Cnodeid</Parameter>
</ParameterDefinition>
</ParameterVisualization>
</Parameterdef>
Depends on node value i have to parse hole xml and needs to get the value of that node if that node is exist.
Require OutPut:
1,2,N/A(because Cnode is not defined)
XPath functions
name()andlocal-name()can be used to read the name of an unknown element. These are then compared to element values in a predicate. I’m assuming that the line</MLinkParameterDefinition>in your sample code was a typing error and</ParameterDefinition>was meant instead. In this solution both<ParameterSection>and<Parameter>must have a value that matches an element, it also checks that the value of the id-elements must be non-empty.Output with your (fixed) sample input
No space between commas and no comma after last value.
Somehow I feel like keys should be used in these kind of matching problems, but for me this seemed a more straightforward way to solve the problem.