Erik Saltwell explains what this XslCompiledTransform.OutputSettings property is and why it exists. That's really fresh, clean and powerful design once you get it. I didn't first.
July 2005 ArchivesIf you thought that some smell of XML in C-omega was amazing, believe me that's nothing. Major XML and .NET integration stories are still ahead of us. Something big is cooking inside the house. Look at these news.
Continue reading XML and .Net: fascinating future.
I've just finished moving EXSLT.NET code into the Mvp.Xml project infrastructure. Now on EXSLT.NET is a module of the Mvp.Xml library, its namespace is Mvp.Xml.Exslt, its license is CPL and its home page is http://mvp-xml.sourceforge.net/exslt. That's pretty much all changes. Go download Mvp.Xml library v1.1, now including EXSLT.NET module in addition to Common, XInclude.NET and XPointer.NET modules. My next move will be converting EXSLT.NET module to .NET 2.0. That should be easy. XPathReader v1.1 is available for download. XPathReader is originally developed inside Microsoft and then dropped out as open-source implementation of a pull-based XML parser that supports XPath queries while parsing the XML document. It's basically XmlReader that supports streaming subset of XPath 1.0. Read "The Best of Both Worlds: Combining XPath with the XmlReader" article for more info about XPathReader. New in this release:
In .NET 2.0 XPathNavigator finally has SelectSingleNode() method! MSXML and XmlDocument (XmlNode actually) have it forever and it's so widely used because it's soooo handy. Obviously despite its name, XPathNavigator.SelectSingleNode() returns not a node, but node equivalent in XPathNavigator's data model - XPathNavigator. And this method is even better than XmlNode's one, because it has overloads accepting compiled XPathExpression, so when running within a loop you don't have to pay XPath compilation price on each iteration. That's another reason to switch completely to XPathNavigator API when processing XML in .NET 2.0. nxslt 1.6 and nxslt2 Beta1 are available for download. For those not familiar with nxslt: nxslt is free feature-rich .NET XSLT Command Line Utility. nxslt 1.6 is the next version for the .NET 1.X Frameworks. New features include optionality for source XML or stylesheet, pretty printing, ASCII only escaped output and support for "omit-xml-declaration" attribute of the exsl:document extension element. nxslt2 Beta1 is the first beta version of the next major nxslt release. nxslt2 uses new XSLT 1.0 processor in the .NET 2.0 Framework - System.Xml.Xsl.XslCompiledTransform class. Hence it requires .NET 2.0 Beta2 (which you can download here) or higher. As a first beta version, nxslt2 Beta1 is quite limited - no support for XInclude, EXSLT, multiple output and embedded stylesheets. As far as I port EXSLT.NET and XInclude.NET to .NET 2.0 I'll update nxslt2. New Microsoft XSLT Processor (XslCompiledTransform) is a great stuff. Compiles XSLT to MSIL and runs as fast as MSXML4. I'll be writing about it a lot soon. With nxslt2 you can give it a whirl. The company I'm working latest 5 years for, Multiconn Technolgies, has melted finally down. 4 developers left including myself have been picked up by a parent company, BluePhoenix Solutions and so now on I'm working for a company with funny name Outlook & BluePhoenix. I will be woking on a product for converting old rusty IDMS mainframe applications to Windows 2003/Oracle/Cobol.NET + Web Services as an added value. Not bad, it could be worse. My new program manager gave my this book to read while the project slowly starts rolling: You see - it's not so bad. 42. "Make all your family blogging" - done.
Microsoft refreshes their professional certifications program: Changes are afoot in the Microsoft Certification Program that can be labeled as "evolutionary"; that is, changes to the certification process will be implemented over time, as newer technologies become generally available. According to Valvano, Microsoft will follow tradition, releasing exams for SQL Server 2005 and Visual Studio 2005 about 45 days after the release of the products to the general public. Those exams, however, won't fit into the traditional MCP schema that one might be familiar with. Instead, Microsoft will introduce a new framework for certification that will pair up a credential with a skill-identifying certification based on a tiered approach consisting of the following credentials: WebServicesSummit.com has released two podcasts of a panel discussion with Ron Bourret, Dana Florescu, Michael Kay, Jonathan Robie and Michael Rys. The discussion topics include XQuery, native XML databases, SQL/XML databases, XSLT and related topics.I didn't listen yet, but sure it's a great stuff. I was wrong in my last post. Here is how one can output HTML with XslCompiledTransform when XmlResolver needs to be passed to Transform() method. using (XmlReader src = XmlReader.Create("../../source.xml")) { XslCompiledTransform xslt = new XslCompiledTransform(); xslt.Load("../../style.xslt"); XmlWriter result = XmlWriter.Create(Console.Out, xslt.OutputSettings); xslt.Transform(src, null, result, new XmlUrlResolver()); }The key line is emphasized. One just needs to pass XslCompiledTransform's OutputSettings (after XSLT stylesheet is loaded) to XmlWriter.Create() method and then resulting XmlWriter will output transformation results according to <xsl:output> settings in the XSLT stylesheet. Really nice once I get it.
Continue reading Outputting HTML with XslCompiledTransform and XmlResolver.
I'm porting nxslt utility to .NET 2.0 with XslCompiledTransform as XSLT processor and I just found out XslCompiledTransform API is really severe broken. I was writing before that the only Transform() method overload that accepts XmlResolver outputs to XmlWriter. So if you want to create HTML and to have some control over document() function resolving (or just provide user credentials), you are out of luck with XslCompiledTransform. Quite common scenario, isn't it? Too bad, XML Team should hire better testers.
Continue reading XslCompiledTransform API bug (update - not a bug, my fault).
What I dislike in System.Xml v2.0 (and v1.X for that matter) is a poor support for push-based XML processing. Somehow it's all about pull - XmlReader, while push - XmlWriter seems to be a second class citizen. For instance one can't populate XML into XPathDocument or XSLT stylesheet into XslCompiledTransform with XmlWriter. One can't deserialize an object from XML if XML is represented as XmlWriter etc. In a nutshell: XML producers in .NET write XML into XmlWriter, while XML consumers read XML from XmlReader. The problem with this mix of pull and push arises when one tries to pipeline a XML producer and a XML consumer, i.e. a component that writes to XmlWriter and another one which reads from XmlReader. Ooops! Think about feeding XML created with XSLT into SqlXml or deserializing an object from an XML modified by XSLT or chaining two XSLT transformations when output from the first one goes as input to the second one or generating XSLT stylesheet on the fly. Most of these problems can't be solved in .NET 2.0 in a streaming fashion and require interim buffering of the whole XML effectively killing scalability and performance. Look here and here. I'm really sorry to see interim buffering with serializing/reparsing involved as an XML pipelining solution in a modern technology like .NET 2.0.
Continue reading Loading XPathDocument with XmlWriter.
I know I'm late, but anyway here is the latest Dimitre's puzzle. Don't post your anwers here, just send them him to dnovatchev AT gmail DOT com. Dimitre will be collecting answers only for another week, so hurry up. I just started reading the book "The Da Vinci code" and this resulted in having some fun with XSLT 2.0, Saxon 8.4 and Saxon.NET. Hey, I just noticed that Webhost4Life (web hosting company where I host my sites) greatly increased disk and database space available with their hosting plans - now for the same $10/mo one can get 2Gb of disk space, 2Gb of MS SQL and 2 Gb of MySQL. Hmm, 6 times more, really generous offer. Needless to mention Windows 2003, .NET 1.1, Sharepoint, unlimited traffic, unlimited domains etc etc etc. Sounds like a commercial so I better stop. Still please refer to me when buying web hosting at Webhost4Life, my member ID is "olegt". |
Recent Comments