April 19, 2005

Docbook stylesheets adapted for .NET

Sadly but fact, .NET 1.X XSLT processor - XslTransform class has some nasty bugs. Actually it even can't load Docbook stylesheets :( So it was really nice to see Altsoft (maker of Xml2PDF tool) has adapted Docbook 1.68.1 stylesheets to make them working in .NET. Changes are really small. ...

Microsoft fingerpring reader - Windows XP only?

After reading this, I bought this: just to realize the damn fingerprint reader only works with Windows XP and I've got XP only on my laptop. Oh, shit. Can you believe it? Microsoft fingerprint reader doesn't work with Microsoft Windows Server 2003 or Windows 2000. :( Oh well, still it's ...

Microsoft Knowledge Base - RSS is here

Finally Microsoft Knowledge Base provides RSS feeds. Quite expressive list. [Via Sergey Simakov] ...

Dave Pawson is blogging!

Dave Pawson is blogging! Great, subscribed. ...

Clent side XSLT - now in Safari browser

As many were saying, XSLT is finally coming to client side. The rumors came true today - latest version of the Safari browser from Apple supports XSLT via libxslt. Now what about Opera? [Via Cafe con Leche] ...

April 17, 2005

XslCompiledTransform (new XSLT 1.0 processor in .NET 2.0) - no more pull-mode XSLT

I'm studying new XSLT 1.0 implementation provided by Microsoft in the .NET 2.0 Beta2 - XslCompiledTransform class. The guys who wrote it are my good friends and excellent developers, but let me to complain a little bit, not because I'm a complainer, but trying to make this cool piece of ...

XslTransform class, now obsoleted in .NET 2.0 has a very nice feature - it allows to perform pull-mode XSL transformations. The result of the transformation can be an XmlReader object and the actual transformation occurs only when you call that reader methods. That feature, traditionally overlooked and rarely mentioned (come on, who cares about perf nowadays, right?) enables very efficient XML pipelining with no temporary XML stores. If a component (such as SqlXml class) accepts XML as an instance of XmlReader and you need to feed it with XSLT output that is easy and efficient. I was trying to promote this feature with XmlTransformingReader class, which you can find in the Mvp.Xml library.

Now, new and shiny XslCompiledTransform class doesn't support this feature anymore, transformation output is now only Stream, TextWriter or XmlWriter, so it's pure push-mode transformer. That actually simplified API a bit, but now in a scenario when you need a transformation result as an XmlReader one needs 1) a temporary XML storage and 2) write nasty complicated code like this:

// Load XSL transformation
XslCompiledTransform xform = new XslCompiledTransform();
xform.Load (xslPath);
// Execute/Cache results
XmlDocument resultsDoc = new XmlDocument();
XPathNavigator resultsNav = resultsDoc.CreateNavigator();
// using makes sure that we flush the writer at the end
using (XmlWriter writer = resultsNav.AppendChild()) 
{
  xform.Transform(XmlData.CreateReader(), writer);
}
// Return results
SqlXml retSqlXml = new SqlXml (resultsNav.ReadSubtree());
return (retSqlXml);
It's from Michael Rys's excellent webcast on "Managing XML Data on the Database with SQL Server 2005 and Visual Studio 2005". Temporary XML document, what can be worse? In .NET 1.X this could be done much easier and efficient:
// Load XSL transformation
XslTransform xform = new XslTransform();
xform.Load (xslPath);

//Load source XML
XPathDocument doc = new XPathDocument(XmlData.CreateReader());

// Return results
SqlXml retSqlXml = new SqlXml (
  xform.Transform(doc, null, new XmlUrlResolver()));
return (retSqlXml);

Now that's a pity .NET 2.0 doesn't add any new XSLT-related functionality, but even cuts off some :( I wonder if this was cut because it was unfeasible to implement with new XslCompiledTransform architecture or the reason was a different one. Oh well, I filed this issue as a bug. Go vote for it if you care.

April 11, 2005

Useless RSS feeds

I was writing very enthusiastically about upcoming MSDN webcasts RSS feed. It's really nice to see more and more orange XML icons on Microsoft sites. But what about quality? I was trying to make use of the the webcasts RSS feed and found it merely useless. What information would you ...

C-Omega webcast at May 11

Interesting webcast: Learn about Cω (C-Omega), an experimental research language from Microsoft Research that extends Microsoft Visual C# with new constructs for relational and semi-structured data access as well as asynchronous concurrency. Cω is a strongly typed, data-oriented programming language that bridges the gap between semi-structured hierarchical data (XML), relational ...

April 9, 2005

Visual Studio 2005 Beta2 in just 16 days?

Hey, just look at this. It says Visual Studio 2005 Beta2 will ship April 25, in just 16 short days and nights. Great. After Visual Studio .NET and Visual Studio .NET 2003 it's third version and it will rock not only according to the third version law. I especially enjoy ...

April 6, 2005

5 years in Israel

Today it's 5 years as my wife and I repatriated to Israel (in Hebrew it's called aliyah - ascent) from Ukraine. I'm happy we did it. Today Israel is our country and we just love it, it's amazing, unique and beautiful. ...

XQuery as Perl for XML

New bunch of XSL/XQuery working drafts has been published, some in Last Call. Now it's 12 documents, including a new interesting one. Changes are mostly minor though so if they wouldn't get another zillion of comments (do many realize than by posting a comment, even about a small typo to ...

April 3, 2005

XML Indexing Article went live

Part 1 of my "Indexing XML" article went live at the MSDN XML Dev Center. In this article I discuss various aspects of indexing standalone XML documents - XML IDs, XSLT Keys and introduce IndexingXPathNavigator class, part of the Mvp.Xml library, which enables lazy or eager indexing of any IXPathNavigable ...

XInclude + XML Schema validation = Ooops!

Norm Walsh writes about a very nasty problem waiting to happen when anybody naive enough is trying to validate an XML document after XInclude processing against XML Schema. Ooops, XInclude processor appends xml:base attributes at top-level included elements, which you gotta allow in the schema, most likely on every element ...

One interesting point Norm raised is how come this glitch happened:

I think what pains me most about this situation is that XInclude was in development for just over five years. It went through eleven drafts[1] including three Candidate Recommendations.
Why didn't we notice this until several months after XInclude was a Recommendation?
Basically I disagree. Of course this incompatibility wasn't unnoticed. Moreover you can find the following in the "DocBook Technical Committee Meeting Minutes: 19 Nov 2002":
615587 Support xml:base
Any object to adding xml:base to the common attributes? None.
Accepted.
You get the idea of what is the common solution - just declare xml:base and xml:lang in your schema.

And what about better solutions? Norm talks about fixing either XML Schema or XInclude. I don't see why XInclude needs to be fixed here. It's clear that if a fragment comes from a different place its base URI must be preserved somehow, otherwise say good bye to relative URIs in included fragment. And xml:base is currently the only feasible facility of base URI manipulation. But when it comes to XML Schema I see plenty of room for improvements - it could either allow to define globally allowed attributes or to allow xml: attributes to appear anywhere, just like xsi:type at al.

What's wrong with the latter solution? xml:base, xml:lang, xml:space, xml:id - isn't it ridiculous to be forced to declare them on every element in XML Schema? They are orthogonal to validation and so XML Schema validation should be orthogonal to them.

Another interesting tidbit - this issue was reported to the MSDN Product Feedback Center by kzu and his suggestion to introduce a flag to the XmlSchemaValidationFlags enum saying that xml: attributes should be ignored during validation seems to be favorable by Microsoft. There is a chance that in .NET 2.0 XML Schema processor will optionally allow xml:base and friends even if not declared in schema. If you like it - go vote for this suggestion. I did.