Page tree
Skip to end of metadata
Go to start of metadata

Example 1:

XML repeating group tags contain set of values. XSLT scripts will sort them into standart FIXML repeating group.

InputXSLT scriptOutput
<?xml version="1.0" encoding="utf-8"?> 
<FIXTradeStifel> 
	<UpdateReasonsCount>3</UpdateReasonsCount> 
		<UpdateReasons> 
			<anyType>Price</anyType> 
			<anyType>Principal</anyType> 
			<anyType>Net</anyType> 
		</UpdateReasons> 
		<UpdateValues> 
			<anyType>10.00</anyType> 
			<anyType>10000.00</anyType> 
			<anyType>10000.00</anyType> 
		</UpdateValues> 
</FIXTradeStifel>

 

 

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml"/>
	<xsl:template match="/">
		<FIXMessage>
			<g6041>
				<xsl:attribute name="v">
					<xsl:value-of select="/FIXTradeStifel/UpdateReasonsCount"/>
				</xsl:attribute>
				<xsl:for-each select="/FIXTradeStifel/UpdateReasons/anyType">
					<xsl:variable name="Position" select="position()"/>
					<e>
						<f6042><xsl:value-of select="."/></f6042>
						<f6043><xsl:value-of select="/FIXTradeStifel/UpdateValues/anyType[$Position]"/></f6043>
					</e>
				</xsl:for-each>
			</g6041>
		</FIXMessage>
	</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<FIXMessage>
	<g6041 v="3">
	<e>
		<f6042>Price</f6042>
		<f6043>10.00</f6043>
	</e>
	<e>
		<f6042>Principal</f6042>
		<f6043>10000.00</f6043>
	</e>
	<e>
		<f6042>Net</f6042>
		<f6043>10000.00</f6043>
	</e>
	</g6041>
</FIXMessage>
  • No labels