Home > Uncategorized > XSL stylesheet for displaying serialized datasets

XSL stylesheet for displaying serialized datasets

A utility I wrote some time ago http://www.webtropy.com/articles/art22-SQLCache.asp?SQL%20Server%20Performance for increasing SQL server (repeat) performance using XML caching used XMLSerializer to create XML files which were serialized versions of Datasets returned from SQL server.
I was looking for an easy way to display the contents of these files, without sifting through XML. I decided to have a look at writing a generic XSL style sheet to view these serialized datasets. First, I add a line to the top of the xml file:
<?xml-stylesheet type="text/xsl" href="dataset.xsl"?>
where dataset.xsl is:
<?xml version=’1.0′?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
<xsl:template match="/">
    <xsl:for-each select="DataSet/xs:schema/xs:element/xs:complexType/xs:choice/xs:element/xs:complexType/xs:sequence/xs:element">
         <td><b><xsl:value-of select="@name"/></b></td>   
    <xsl:for-each select="/DataSet/diffgr:diffgram/NewDataSet/*">
    <xsl:for-each select="*">
         <td><xsl:value-of select="." /></td>   
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: