Hello,
I'm having a nightmare with something that is supposed to be straight forward, and came here looking for some help
It's an XML file with a reference to an external XSL file that XSLT code to transform the structure of the XML nodes and output XML with a different structure... When I open the XML in any browser, only the data inside the XML nodes displays (as text), instead of the expected rendering of the XML tree. What am I missing?
The input XML file (simplified) contains:
<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="MyTemplate.xsl"?><Report><table1><table1_Employee_Group_Collection><Employee><XRefCode>000001234</XRefCode><EmployeeNumber>000001234</EmployeeNumber><FirstName>Mark</FirstName><LastName>Melanine</LastName><JobXRefCode>65130</JobXRefCode><DeptXRefCode>DEPT0090</DeptXRefCode><OrgXRefCode>850</OrgXRefCode><IsPrimary>0</IsPrimary><EffectiveStart>2011-03-28</EffectiveStart></Employee><Employee><XRefCode>000001234</XRefCode><EmployeeNumber>000001234</EmployeeNumber><FirstName>Mark</FirstName><LastName>Melanine</LastName><JobXRefCode>65130</JobXRefCode><DeptXRefCode>DEPT0015</DeptXRefCode><OrgXRefCode>850</OrgXRefCode><IsPrimary>0</IsPrimary><EffectiveStart>2011-02-28</EffectiveStart></Employee><Employee><XRefCode>000007890</XRefCode><EmployeeNumber>000007890</EmployeeNumber><FirstName>Summer</FirstName><LastName>Spring</LastName><DeptXRefCode>DEPT0011</DeptXRefCode><OrgXRefCode>120</OrgXRefCode><IsPrimary>0</IsPrimary><EffectiveStart>2010-12-27</EffectiveStart></Employee><Employee><XRefCode>000007890</XRefCode><EmployeeNumber>000007890</EmployeeNumber><FirstName>Summer</FirstName><LastName>Spring</LastName><DeptXRefCode>DEPT0090</DeptXRefCode><OrgXRefCode>120</OrgXRefCode><IsPrimary>0</IsPrimary><EffectiveStart>2010-12-27</EffectiveStart></Employee><Employee><XRefCode>000007890</XRefCode><EmployeeNumber>000007890</EmployeeNumber><FirstName>Summer</FirstName><LastName>Spring</LastName><DeptXRefCode>DEPT0001</DeptXRefCode><OrgXRefCode>110</OrgXRefCode><IsPrimary>0</IsPrimary><EffectiveStart>2011-01-24</EffectiveStart></Employee></table1_Employee_Group_Collection></table1></Report>
the XLT file MyTemplate.XSL (simplified) contains:
<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/><xsl:template match="/Report/table1/table1_Employee_Group_Collection"><EmployeeImport><xsl:apply-templates select="Employee"/></EmployeeImport></xsl:template><xsl:template match="Employee"><XRefCode><xsl:value-of select="XRefCode"/></XRefCode><FirstName><xsl:value-of select="FirstName"/></FirstName><LastName><xsl:value-of select="LastName"/></LastName></xsl:template></xsl:stylesheet>
This is what the browser actually renders:
<xrefcode>000001234</xrefcode> <firstname>Mark</firstname> <lastname>Melanine</lastname> <xrefcode>000001234</xrefcode> <firstname>Mark</firstname> <lastname>Melanine</lastname> <xrefcode>000007890</xrefcode><firstname>Summer</firstname> <lastname>Spring</lastname> <xrefcode>000007890</xrefcode> <firstname>Summer</firstname> <lastname>Spring</lastname> <xrefcode>000007890</xrefcode> <firstname>Summer</firstname><lastname>Spring</lastname>
Where are my "tags"?
I tested in IE10, IE8 (XP SP3), FF, and Chrome, and none displays what I was expecting, which is:
- <EmployeeImport> - <Employee><XRefCode>000001234</XRefCode><FirstName>Mark</FirstName><LastName>Melanine</LastName></Employee> (more employee nodes here...) </EmployeeImport>
I really appreciate your help. Thanks in advance
Sincerely,
Rick