Developer FAQ

If I use the std. XSLT approach using <xsl:copy-of select=”/” /> the XML output gets ‘examined’ by C1 and in certain situations ‘transformed’ before it ends up as XHTML on my browser. How can I get a completely “raw” copy of the XML that is given to my XSLT?

Answer:

You can download and use the XSLT document Dump raw XSLT input.xslt.

The <xsl:copy-of /> construct wont show you “the read deal” in a situation, where parameters of your XSLT Function are fed items like <rendering: placeholder /> or certain function call results. This is because C1 is giving your XSLT an “intermediate document structure” which has not yet been normalized / ASP.NET enabled.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xsl in msxsl csharp"
	xmlns:in="http://www.composite.net/ns/transformation/input/1.0"
	xmlns:msxsl="urn:schemas-microsoft-com:xslt"
	xmlns:csharp="http://c1.composite.net/sample/csharp"
	xmlns="http://www.w3.org/1999/xhtml">

  <xsl:template match="/">
    <html>
      <head />
      <body>
        <pre>
          <xsl:copy-of select="csharp:GetAsString(/)" />
        </pre>
      </body>
    </html>
  </xsl:template>

  <msxsl:script implements-prefix="csharp" language="C#">
    <msxsl:assembly name="System.Xml.Linq"/>
    <msxsl:using namespace="System.Xml.Linq"/>
    <msxsl:using namespace="System.Xml"/>
    <msxsl:using namespace="System.Xml.XPath"/>

    public string GetAsString(XPathNavigator nav)
    {
      return XDocument.Parse( nav.OuterXml ).ToString();
    }
  </msxsl:script>

</xsl:stylesheet>

Download the source