First of all, to the best of my knowledge, this is not about just xml transformation using XSL. It's about the way the xml is being presented to me. I've searched all I can but I can't find a scenario similar to the one I have.
XML source:
<?xml version="1.0"?>
<RepData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<requestId>2313022420.01</requestId>
<requestTimeStamp>2018-JUN-30T06:13:40Z</requestTimeStamp>
</Header>
<responseProcessing>
<translatorContext/>
<styleSheet/>
</responseProcessing>
<serviceResponse>
<Report docType="ACCOUNT">
<dataSet name="ACCOUNT_DETS">
<fieldDefinition index="1" id="ACCOUNT_ID" label="Account Number" type="ALPHANUMERIC" length="19" repeatable="FALSE"/>
<fieldDefinition index="2" id="ACCOUNT_NAME" label="Account Name" type="ALPHANUMERIC" length="35" repeatable="FALSE"/>
<fieldDefinition index="3" id="CURRENCY" label="Currency" type="ALPHANUMERIC" length="25" repeatable="FALSE"/>
<fieldDefinition index="4" id="AMOUNT" label="Account Balance" type="ALPHANUMERIC" length="19" repeatable="FALSE"/>
<record>
<field index="1">100004087</field>
<field index="2">MY EURO ACCOUNT</field>
<field index="3">Euro</field>
<field index="4">530,000</field>
</record>
<record>
<field index="1">200008169</field>
<field index="2">USD CASH ACCOUNT</field>
<field index="3">US Dollar</field>
<field index="4">2,924.82</field>
</record>
</dataSet>
</Report>
</serviceResponse>
</RepData>
From the source, the fields are defined under the fieldDefinition element. And the values are in the field element.
I can't seem to get a way to iterate through fields to pick the field values.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="RepData/serviceResponse/Report/dataSet/record" >
<html>
<body>
<table border="1">
<tr bgcolor="#9acd32">
<th>Account</th>
<th>Balance</th>
</tr>
<xsl:for-each select="RepData/serviceResponse/Report/dataSet/record/field">
<p>
<xsl:value-of select="RepData/serviceResponse/Report/dataSet/record/field" />
</p>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The XSL above only returns blank but if I add 'mode="toc"' to the match all data I get a dump of all values in the xml:
2313022420.01 2018-JUN-30T06:13:40Z 100004087 MY EURO ACCOUNT Euro 530,000 200008169 USD CASH ACCOUNT US Dollar 2,924.82
This is what I'm going for (the field names are from the label attribute in fieldDefinition):
Account Number|Account Name |Currency |Account Balance
100004087 |MY EURO ACCOUNT |Euro |530,000
200008169 |USD CASH ACCOUNT |US Dollar |2,924.82
