-
Last year I created and uploaded a demonstration project to Popfly that converted a Word 2007 Document to a WPF FlowDocument. The best example of a FlowDocument can be seen in the New York Times Reader , an instance of Syndicated Client Starter...( Read More...
-
One of the challenges with creating online documentation is readability, especially with long documents. Most of the time, we end up printing out documents instead of attempting to read them online. One we print them out we lose the ability to easily search for text, one of the great aspects of online documents. Creating a great online reading experience was one of the major goals with the WPF FlowDocument, a XAML element that can put into any WPF application as well as being natively hosted by Internet Explorer. To see an example of a FlowDocument, take a look at a whitepaper that I recently wrote on Silverlight and Web Analytics.
In their most basic form, FlowDocuments are XAML markup, similar in form to XHTML documents. In addition to HTML, FlowDocuments add automatic column flow, search, scaling, readability enhancements, and hyphenation. Indeed it would be conceivable to transform XHTML to FlowDocuments using XSLT, because both formats are XML. I started looking around and I couldn't find any tools for creating FlowDocuments, especially with the authoring tool that I use (in addition to Windows Live Writer), Microsoft Word. Wait! Can't I just transform the Word Open XML into the FlowDocument XAML using XSLT? I sure can. In a few hours, I built a sample Word 2007 Ribbon Add-in that transforms the Word Open XML (WordML) of any Word 2007 document into the FlowDocument XAML. I will be sharing the source code for this Office Business Application (OBA) solution as well.
On November 29th at 11:00 AM PDT, I will be presenting in a live Webinar on how I built this solution with Visual Studio 2008 Beta 2(Orcas). Here's what I'll cover:
- Show how to use Visual Studio 2008 to create Office 2007 (and 2003) Add-ins.
- Show how to use the new visual Ribbon Designer in Visual Studio 2008 to craft a ribbon interface for Word
- Show how to to use WPF windows within a Word 2007 Add-in
- Walk through the transformation code
- Demonstrate the FlowDocument format
If you are interested in coming to the webinar (it will be recorded if you cannot make it) please register here.
-
A common practice with Rich Interactive Applications (RIAs) is to expose the text as hidden DIV section in on the same page as the Silverlight control. I have crafted a page with a Silverlight application that has a unique word on it that is picked up by Google's search engine. When search crawlers see the page, they don't see the Silverlight XAML but they do see the XHTML that is generated by transforming the XAML into XHTML. Using the ASP.Net <asp:Xml> element and specifying an XSL Transformation that does this translation:
<div id="SLHost">
<asp:Xml ID="XHTML" runat="server" DocumentSource="seo.xaml" TransformSource="XAML2XHTML.xslt" EnableViewState="False"/>
<script type="text/javascript">
createSilverlight();
</script>
</div>
Try using this technique for your Silverlight applications running ASP.Net. Here is how the content is transformed:
- <Canvas> elements are turned into <div> tags
- <TextElement> elements are turned into <div> tags with the text inside
- <Run> elements are turned into <span> tags
- <Image> elements are turned into <img> tags
- <MediElement> elements are turned into <a href> hyperlinks.
It doesn't produce pretty XHTML but search engines don't care about that. take a look at the XSLT transform and see how simple it actually is. Using this technique, when the XAML changes, the plain-text XHTML content changes as well.
-
If you look at the XML generated by the OneNote 2007 API, you will notice that the text outline sections are all escaped with CDATA[] elements. This, in my opinion is bad form. I am working on transforming the OneNote XML to Silverlight XAML using XSLT and having that portion of the XML escaped makes it more difficult to parse and transform. My guess is that it's like this because much of the HTML is copied from web browsers and HTML is not always well-formed XML (XHTML is). Coming from MindManager that always used well-formed XHTML for note in the XML, I would like much more usable XML from OneNote 2007.
Instead of this:
<
one:OE creationTime="2006-01-25T02:41:25.000Z" lastModifiedTime="2006-03-02T22:01:00.000Z" objectID="{B64DE6F4-60DB-0E93-07D6-DBBDCDBF80A3}{77}{B0}" alignment="left"> <
one:T> <![CDATA[
In addition to features covered in the <a href="onenote:Getting%20Started%20with%20OneNote.one">Getting started</a> section, OneNote has additional tools that can help you in several activities. <span
style='font-weight:bold'>Click these links</span> to explore. Use the <span
style='font-weight:bold'>Back arrow button</span> on the toolbar to return to this page:
]]> </
one:T> </
one:OE> Use this:
<
one:OE creationTime="2006-01-25T02:41:25.000Z" lastModifiedTime="2006-03-02T22:01:00.000Z" objectID="{B64DE6F4-60DB-0E93-07D6-DBBDCDBF80A3}{77}{B0}" alignment="left"> <
one:T> In addition to features covered in the
<a href
="onenote:Getting%20Started%20with%20OneNote.one">Getting started</a> section, OneNote has additional tools that can help you in several activities. <span style
='font-weight:bold'>Click these links</span> to explore. Use the <span style
='font-weight:bold'>Back arrow button</span> on the toolbar to return to this page: </
one:T> </
one:OE> Here are two questions:
- Is the HTML in OneNote 2007's CDATA sections well-formed XML?
- Does anyone have any cool tricks to convert non-well-formed HTML to well-formed XHTML?
-
I have been working with XML for most of my career, from developing a CAD application to my roles at Mindjet to my new role at Microsoft talking about Silverlight. In this career, I have given numerous talks about the relevance of XML and to be susinct, I have it boiled down to this:
XML is about Partnerships.
Whether that partnership are one-to-one or one-to-many, in my opinion, XML is the right technology to use when you want systems to interoperate with eachother. One type of XML is called XSLT, which is a transformational XML language that defines how one XML set of data transforms to another, so given this XML fragment of Mindjet MindManager XML:
<ap:Topic xmlns:ap="...">
<ap:Text PlainText="Silverlight Rules"/>
</ap:Topic>
this XSLT fragment:
<xsl:template match="ap:Topic" xmlns:xslt="..." xmlns:ap="...">
<TextBlock Text="{ap:/Text/@PlainText}" xmlns="..."/>
</xsl:template>
Produces this Silverlight XAML:
<TextBlock Text="Silverlight Rules" xmlns="..."/>
The significance of this is that you can write an XSL transform from almost any XML language to another: THIS IS BIG! That means that if you have content in one XML format, you can transform it to another. A few years ago, I did a simple demo (that only works on Internet Explorer) on my personal website that used XSLT to make a browser for sketches that I did over the years (click on the about link on top to see how it was done). When I was at Mindjet, I created numerous demos on the Mindjet Labs that used XML and XSLT to get data into and out of MindManager. As you can see, I love working with XSLT!
When I first heard about XAML and Silverlight last year, I started getting very excited about the possibilites that it could enable especially with transforming data from MindManager's XML to XAML. One of the XML languages that I started working with at Mindjet was the RibbonX XML for Office 2007 Ribbon UI for Word 2007. Before I joined Microsoft, I started thinking about how I could transform RibbonX XML to Silverlight's XML (XAML) to present a website's user interface. This was a fun exercise for me and I really learned Silverlight's XAML. What I created from that was http://xmldocs.net. I am now seeing others that are using Silverlight to render all types of XML data, like XPS files. This is why I believe that Silverlight's XML data model is significant. Now, the next thing that I want to look at Popfly.
Links:
What XML do you want to see in Silverlight? To get some ideas, look at all of the web services on Programmable Web (most web services are XML-based).
-
From it's inception in September 2005 to September 2006, I managed the content for the Mindjet Labs using MindManager. I created a JavaScript and an XSL transformation that turned the XML of the map into the HTML pages that made up the Mindjet Labs Read More...
-
I just got an unsolicited email today about one of the more popular solutions, on the Mindjet Labs, the HTML Help Builder which converts MindManager .mmap files to Compiled Help .chm files. One of the members of this little Mindjet Labs community sent Read More...