MXSL Framework for VB.NETMXSL Framwork: Object Model + XSL
to render html, xml, PDF, ..whatever in a read-only format on the web.
I started work on a framework that allows a strong-typed List object in .NET to be easily transformed to html with an XSL stylesheet.
A User Control can have a public property of XSLURL which can be set to point to different XSL stylesheets on the fly.
XML is stored in memory or on a hard drive.
XML or XSL can come cross domain from a remote server.
Strong type objects can be embedded to create a nested XML document.
If you would like to help with framework construction, hit me up.
Preceding-Sibling | The Easy Way
Keeping on track with my previous post regarding the preceding-sibling approach to getting unique values with XSL, I prefer to not have to do the Muench method whenever possible. I like to keep it simple. Here is a really simple way to get a unique or distinct list of categories and sub-categories from an xml file:
<xsl:variable name="thisNodeCategory" select="Category"/>
<xsl:value-of select="Category" />
<xsl:if test="SubCategory > ''">
- <a href="">
<xsl:value-of select="SubCategory" />subcategory
Easier than preceding-sibling::
I don't like to use preceeding-sibling. It doesn't work when I want it to. So, I created a method that works just like it:
This method is a lot easier to implement. But, it doesn't work with <xsl:sort>. It requires the XML be in the correct sort order before doing the XSL Transform. If you don't have this luxury, you can use the method I will post in the following blog post. Or, if you are really brave, you can use the Muench Method. I think I posted how to do that in a previous post. Well, anyway you decide to do it, good luck.
<xsl:variable name="thisChildNode" select="Category"/>
<xsl:variable name="lastNodePosition" select="position() - 1"/>
<xsl:if test="not(/grandParentNode/parentNode[$lastNodePosition]/childNode = $thisChildNode)">
<h2><xsl:value-of select="childNode" /></h2>
PORDL Mobile Pages Released
By request, every XSL transform on PORDL now comes with its own mobile-ready webpage.
You can point your cell phone directly to the page or setup a sub-domain for your website to point to the page.
It is also really easy to create a mobile website by adding html navigation to the top or bottom of your XSL stylesheets and pointing the nav links to other PORDL transforms.
Nested List Sitemap From a Flat XML File
I needed to build a Sitemap where each sub-level is indented more than the top levels...a very typical sitemap. However, my XML file was not in the order it needed to be output to the page and it was a flat XML file, so I couldn't pull the hierarchy from the XML.
I decided to do a template for each level of the sitemap and trigger each template recursively at each level till no more items were available on the level.
It took about 15 hours of staring at code that didn't work till I got it right.
Here is my solution:Nested Sitemap from a Flat XML File
Creating SQL Statements from an XML File
I worked up an XSL Stylesheet to transform a two-column Excel file into a SQL Update Statement.
Here is my order of events:
I saved the Excel File as a .csv file.
I used creativyst.com
to change the .csv to an XML file.
I put a XML header on the file:
I saved the XML file to a web server where I could access it with a URL.
I used PORDL to create a new feed transform with the following XSL:
The output was a clean SQL Update Statement I could use to do a mass update of records on an OsCommerce database.
Grouping XSL Search ResultsHow to group XML items using the Muenchian Method
It took a while to figure this out because no one on the internet had a really good example that was easy to port over for my uses. So, I created an XSL sheet that can easily be ported to most any application.
Embed Any Google News Search Result on Any Website or Blog
Using PORDL.com, you can easily embed any Google News Search result on any website or blog. Create your RSS feed using the following format:http://news.google.com/news?q=web&output=rss
where the "web" portion of the string is your web search terms.
The output can look like the following example, or any way you desire:http://pordl.com/transform.aspx?id=528
depending on the XSL template you use.
Site Map XSL : Valid for SiteMap.org Specification XML
I was chasing my tail for a while trying to figure out why my XSL stylesheets were not working with every XML sitemap I tried. The problem was, every XML sitemap I tried was using an invalid XML namespace. They were using a namespace hosted on Google at http://www.google.com/schemas/sitemap/0.84
. This namespace is invalid. Some were referencing http://www.google.com/schemas/sitemap/0.9
which is also invalid. The correct working namespace to use is http://www.sitemaps.org/schemas/sitemap.0.9
Here is a really simple version of the XSL required to render the Site Map XML (with valid namespace) as HTML:
I, also, added this XSL as one of the many default XSL choices when setting up feed transforms on PORDL.com.
PORDL Site Search
PORDL.com now uses Google's AJAX API web search as a full site search tool.PORDL Site Search
Scrolling Feeds are Now Available
Now, you also have PORDL's feed scroller. It's everything Google's code doesn't do and more. Here is a sample:http://pordl.com/scroller_demo.aspx
New Generic RSS XSLT Sheet
I created a new generic XSL stylesheet for RSS feeds. It handles more types of feeds, looks more professional, and is easier to customize. I did a mass-update of about 350 feeds on the site with this new stylesheet.
Twitter XSLT Stylesheet
I uploaded a new generic XSL Stylesheet for Twitter feeds. It looks far better than the previous stylesheet.
Two Simple Ways to XSL an RSS Feed
There are two really common methods to format an XSL stylesheet for an RSS feed. They both do the same thing but in different ways.
Either of these methods could be used as a default XSL stylesheet that works for most RSS feeds on the net.Method 1:Method 2:NOTE: with this method, you can easily drop an xsl:if type statement inside the xsl:for-each.
PORDL - How to XSL
I setup a page of XSL terms, XSL examples, and links to get more information. Here it is
PORDL Version 0.7 Launched
The latest version of PORDL has been launched. Updates include: feed quantities in the navigation, style changes to the feed page and navigation, and enhancements to the Administrative section. Please have fun embedding stuff.
New Picasa Slideshow Gallery XSL Sheet
I created a new XSL stylesheet that renders a Picasa RSS feed as an Picasa Photo Gallery.
New XSL Stylesheet - Ticker Style RSS Feed
I created a new XSLT stylesheet for PORDL that allows you to embed a ticker-style feed on a site or blog. It wraps the feed in a styleable box. The ticker pauses when you hover over it with your mouse.
New XSL Stylesheets for FlickR RSS feeds
I worked up a new XSLT sheet that ouputs a rotating gallery of image thumbnails from a FlickR feed. Hover over the image and the rotation stops. Click on the image and it opens in a new window. Pretty basic. You can use the default stylesheet on the Edit Stylesheet page or use it as a base for your own XSLT idea.
How to Embed an RSS Feed in a Blog or Website
PORDL.com makes it easy to embed a feed in a blog or website with just one line of code. Register on the site with only your name and email address. Provide a url to the RSS, Atom, or other XML feed you want to embed, select from one of the prebuilt generic XSL stylesheets or edit one of your own, copy the embed code and place it in your blog or website. It is super simple.