Wednesday, April 18, 2012

MXSL Framework for VB.NET

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


Advantages:

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.

Saturday, June 11, 2011

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:for-each select="item">
<xsl:variable name="thisNodeCategory" select="Category"/>
<xsl:if test="not(preceding-sibling::item[Category=$thisNodeCategory])">
<span class="Category">
<a href="">
<xsl:value-of select="Category" />
</a>
</span>
<br/>
</xsl:if>
<xsl:if test="SubCategory > ''">
<span class="subCategory">
- <a href="">
<xsl:value-of select="SubCategory" />subcategory
</a>
</span>
<br/>
</xsl:if>
</xsl:for-each>

Friday, June 10, 2011

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>
</xsl:if>

Sunday, March 13, 2011

PORDL Mobile Pages Released

By request, every XSL transform on PORDL now comes with its own mobile-ready webpage.

Example:
Pastor's Blog

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.

Sunday, February 27, 2011

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

Thursday, February 17, 2011

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.

Friday, February 11, 2011

Grouping XSL Search Results

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