Synopsis
ExtensionData fields are used to store information about your customers or products that doesn't have a place in the database naturally. You may wish to store a customer's wedding date for their registry, or the type of flour to be used in the cake's creation might need altered due to allergies. Storing both would require using XML in the ExtensionData to separate your values:
<ExtensionData>
<Customer>
<WeddingDate>10/11/2012</WeddingDate>
<Allergies>Wheat</Allergies>
</Customer>
</ExtensionData>
When the field is returned in the XML package, it is returned as a string from SQL with all of the data involved. You cannot simply select the ExtensionData node and display it as all of your customized data fields would be displayed at once. The data needs to be parsed out based on the node you've declared. This requires a variable to store the ExtensionData, a variable to store the node you're looking for in that extension data, a variable to store the beginning location of your value, and a variable to store the value of that node. These four variables can be declared in the XSLT (Be sure to declare them in the scope of their use, as XSLT does not hold variable values outside of the templates they are to be used in):
<xsl:variable name="MyExtensionData" select="ExtensionData"/>
<xsl:variable name="MyNodeInExtensionData" select="string('WeddingDate')"/>
<xsl:variable name="MyValueLocation" select="substring-after($MyExtensionData, concat('<', $MyNodeInExtensionData,'>'))"/>
<xsl:variable name="MyValue" select="substring-before($MyValueLocation, concat('</', $MyNodeInExtensionData, '>'))" />
The above code declares your ExtensionData to be used as "MyExtensionData" and fills it with the node "ExtensionData" provided by your XMLPackage. The "MyNodeInExtensionData" variable is then created with a value equal to the name of the node you are looking for in the ExtensionData. In the above example, we are looking for "WeddingDate" The MyValueLocation variable then sets a cursor in the string MyExtensionData to the end of the first occurance of that node*:
10/11/2012</WeddingDate><Allergies>Wheat</Allergies></Customer></ExtensionData>
The MyValue variable takes the remainder of the ExtensionData string shown above and pulls everything before the closing tag defined as "WeddingDate" in the MyNodeInExtensionData variable, leaving:
10/11/2012
Add these four variables to your XMLPackage, change the field name (highlighted in the code as WeddingDate to whatever the field name is you are looking for in your ExtensionData, and you can use that data in the scope of the variables by referring to $MyValue:
<xsl:value-of select="$MyValue"/>
*If the node doesn't exist (case sensitive), the value of this variable will be blank, and your ending value will be blank.