Im looking for a XSLT (1.0) stylesheet.
I have input similar to this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<city country="USA">
Washington
</city>
<city country="USA">
New York
</city>
<city country="Germany">
Berlin
</city>
<country size="big">
USA
</country>
<country size="small">
Germany
</country>
I want output like this:
Country USA
Size: big
Cities:
Washington
New York
Country Germany
Size: small
Cities:
Berlin
I am trying something like a nested for-each loop. But I dont know how to access the node when im inside the other node.
If this is a duplicate question I am sorry: the problem might be that I dont really know how to express my problem to find similar questions.
Nested loops are not necessary. The following stylesheet:
Applied to this input:
Produces:
Note: The input you provided includes a lot of significant whitespace, which I removed in my example.