July 2005 Archives

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.

If 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.

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:

  • Support for look-ahead in predicates such as "foo[bar='baz']". This is done via internal caching using XmlBookmarkReader. This behaviour can be turned off using XPathReader.LookAheadInPredicates property.
  • XPathReader.dll is now has a strong name, so it can be called from strongly named assemblies
  • AllowPartiallyTrustedCallers attribute is applied, so XPathReader.dll can be called by partially trusted callers (e.g. in ASP.NET)
  • A nasty bug with != in predicates is fixed

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.

New management, new project

| 1 Comment | No TrackBacks |

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:

Writing Solid Code: Microsoft's Techniques for Developing Bug-Free C Programs (Microsoft Programming Series).

You see - it's not so bad.

Tkachenko Family Blogroll

| No Comments | No TrackBacks |

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:
  • Tier 1: Microsoft Certified Technology Specialist will require simply passing one to three exams based on a Microsoft technology. As products meet the end of the support lifecycle, its related exam will be retired.
  • Tier 2: Microsoft Certified IT Professional or Professional Developer require a Technology Specialist certification, plus one to three more exams, based on the requirement for a particular path. This tier is tied to job role at an organization, such as Database Developer or Business Intelligence. Recertification will be required to maintain status at this level.
  • Tier 3: Microsoft Certified Architect is a rigorous, board-level certification that requires recertification. Achieving Technology Specialist or IT Professional or Professional Developer certification not a prerequisite to attaining this level of certification.

Ken North:

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.

The part 1 podcast (MP3 audio) focuses primarily on XQuery (running time: 34:03). The part 2 podcast covers native XML databases and XML-enabled SQL databases. Running time is 22:46.
http://www.webservicessummit.com/People/XQueryGuruPanel.htm

Or podcast RSS feeds:

XML, SOA and web services podcasts

SQL/XML and database podcasts
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.

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.

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.

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.

Here's the problem:

Find the first 10-digit prime in consecutive digits of F-3000

Where F-N is the Nth Fibonacci number.
Here are the elements of the sequence of Fibonacci numbers from 0 to 11:

Element: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144
Index: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11


It is *very important* to note that the first "1" in the sequence has index "0", so that everyone will mean the same thing by F-3000

When you have the answer, please, let me know:

1. The 10 digit prime number
2. The xslt code
3. The stylesheet execution time.
4. Your computer -- CPU speed and RAM
5. Whether or not you used any specific extension functions.

Cool Web hosting news

| 2 Comments | No TrackBacks |

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".