I’ve develop an XML stylesheet to transform a relatively simple XML file in VS2010. When I run XSLT Debugging in VS, it renders the expected output in a new window.
So I then added a link to the XSLT file in the source XML:
<?xml-stylesheet type="text/xsl" href="ABC.xslt"?>
However, when I view this file in a browser, I don’t get the transformed result. In IE9, Firefox and Chrome
The XSLT (probably in a modified form) will be used by a third party to generate the final XML, so it’s not essential it works – but it is a useful tool to demonstrate that the output from out database (which generates the starting XML), once transformed, will look like the final XML intended.
XML Example:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="abc.xslt"?>
<afterTreatmentSystemRequest>
<afterTreatmentSystem>
<ID>93073010005597</ID>
<shipmentDate>20120330</shipmentDate>
<technicalApprovalDate>20120330</technicalApprovalDate>
</afterTreatmentSystem>
<executionSettingsDate>2012-03-30T14:17:26</executionSettingsDate>
</afterTreatmentSystemRequest>
XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/afterTreatmentSystemRequest">
<nsmajorassemblyai:storeAfterTreatmentSystemRequest category="MajorAssemblyAdapter" delta="true" version="2.10" xmlns:nsmajorassemblyai="http://majorassembly.mysite.com/ai">
<requestHeader userId="d2vswen"/>
<xsl:apply-templates select="afterTreatmentSystem" />
<xsl:apply-templates select="executionSettingsDate" />
</nsmajorassemblyai:storeAfterTreatmentSystemRequest>
</xsl:template>
<xsl:template match="afterTreatmentSystem">
<afterTreatmentSystem delta="true" dataCardAvailable="true">
<xsl:attribute name="id">
<xsl:value-of select="ID"/>
</xsl:attribute>
<activeCustomer addressCity="" addressCountry="" addressStreet="" addressZip="" customerNumber="" firstname="" name=""/>
<activeProductDate>
<xsl:attribute name="shipmentDate">
<xsl:value-of select="shipmentDate"/>
</xsl:attribute>
<xsl:attribute name="technicalApprovalDate">
<xsl:value-of select="technicalApprovalDate"/>
</xsl:attribute>
</activeProductDate>
</afterTreatmentSystem>
</xsl:template>
<xsl:template match="executionSettingsDate">
<executionSettings causation="plant" issueThreshold="err" systemPriority="2" unresolvedConflictAction="notifyAdmin" userId="d2vswen">
<xsl:attribute name="date">
<xsl:value-of select="."/>
</xsl:attribute>
</executionSettings>
</xsl:template>
</xsl:stylesheet>
UPDATE:
I’ve re-inserted the XML and XSL segments – making sure they match the versions that are working well in VS2010. Following Dimitre’s suggestion to use the IE Developer Tools (F12), I can see that some of the transformation has taken place but I’m still missing the executionSettings element.
Expected Output:
<?xml version="1.0" encoding="utf-8"?>
<nsmajorassemblyai:storeAfterTreatmentSystemRequest category="MajorAssemblyAdapter" delta="true" version="2.10" xmlns:nsmajorassemblyai="http://majorassembly.mysite.com/ai">
<requestHeader userId="d2vswen" />
<afterTreatmentSystem delta="true" dataCardAvailable="true" id="93073010005597">
<activeCustomer addressCity="" addressCountry="" addressStreet="" addressZip="" customerNumber="" firstname="" name="" />
<activeProductDate shipmentDate="20120330" technicalApprovalDate="20120331" />
</afterTreatmentSystem>
<executionSettings causation="plant" issueThreshold="err" systemPriority="2" unresolvedConflictAction="notifyAdmin" userId="d2vswen" date="2012-03-30T14:17:26" />
</nsmajorassemblyai:storeAfterTreatmentSystemRequest>
Previous answer deleted as you fixed the example.
It works for me, both with saxon6 on the command line and IE (9) in the browser