Skip to main content

Posts

Showing posts from December, 2013

XML / XSL Transformation in an ASP.NET Page

If in previous posts I was presenting the greatness of Java when perform XML - XSL transformations, I am attempting now to do the same thing only in ASP.NET and C#. The ASP.NET control that applies XSL templates to XML is called Xml (or <asp:Xml>). In its standard use case, it is very simple to use: specify a DocumentSource attribute pointing to the server location of your XML file; specify a TransformSource attribute indicating the location of the XSL file;     < asp : Xml   DocumentSource ="~/navigation.xml"   TransformSource ="~/breadcrumb.xsl"  runat ="server"   /> The problems however quickly arise -- for example when I use the XML generated by my Navigation TBB , I got error " 'tcm' is an undeclared prefix. Line 1, position 2. ". Obviously, I needed to add the namespace declaration for tcm . My new XML looks like this now: < tcm:ListItems ID = " tcm:1-1-4 " Title = " Root " xmln