Can anyone help me out in getting the below with an array..I have to generate the generalised xsl.. Input XML:
More generalized solution. Requires XSLT 2.0
Applied to the provided sample XML, produces following output:
john
john
The above solution was tested on this site: http://xslttest.appspot.com/
EDIT:
every $x in */name() satisfies $x=$firstNodeName
is XPATH 2.0 construction that checks if all the elements in */name()
sequence are equal to $firstNodeName. So this whole condition actually means checking if a node has more than one child with the same name - this is a condition for checking if we're dealing with json:array
case.