Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: ADO RS Persisted to XML -- How To ?

From: "Joe Fawcett" <joefawcett@----------.------>
To: NULL
Date: 7/8/2005 5:25:00 PM
Somehow one element was removed, here is the full file (emailed as well):

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
  xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882' 
xmlns:rs='urn:schemas-microsoft-com:rowset'
  xmlns:z='#RowsetSchema' exclude-result-prefixes="s dt rs z">
  <xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" />
  <xsl:template match="/">
    <xsl:variable name="fieldData" 
select="xml/s:Schema/s:ElementType/s:AttributeType[not(@rs:hidden)]" />
    <xsl:variable name="columnCount" select="count($fieldData)" />
    <xsl:variable name="columnWidth" select="floor(100 div $columnCount)" />
    <div id="divMain" style="margin:0px">
      <table border="1" width="100%" cols="{$columnCount}">
        <thead>
          <tr style="font-size:9pt;background-color:#0000cc;color:#ffffff">
            <xsl:apply-templates select="$fieldData">
              <xsl:with-param name="columnWidth" select="$columnWidth" />
            </xsl:apply-templates>
          </tr>
        </thead>
        <xsl:apply-templates select="xml/rs:data">
          <xsl:with-param name="fieldData" select="$fieldData" />
          <xsl:with-param name="columnCount" select="$columnCount" />
          <xsl:with-param name="columnWidth" select="$columnWidth" />
        </xsl:apply-templates>
      </table>
      <br />
    </div>
  </xsl:template>
  <xsl:template match="s:AttributeType">
    <xsl:param name="columnWidth" />
    <th width="{$columnWidth}%">
      <xsl:choose>
        <xsl:when test="@rs:name">
          <xsl:value-of select="@rs:name" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="@name" />
        </xsl:otherwise>
      </xsl:choose>
    </th>
  </xsl:template>
  <xsl:template match="rs:data">
    <xsl:param name="fieldData" />
    <xsl:param name="columnCount" />
    <xsl:param name="columnWidth" />
    <tbody style="color:#0000cc;font-size:9pt;">
      <xsl:apply-templates>
        <xsl:with-param name="fieldData" select="$fieldData" />
        <xsl:with-param name="columnWidth" select="$columnWidth" />
      </xsl:apply-templates>
    </tbody>
  </xsl:template>
  <xsl:template match="z:row">
    <xsl:param name="fieldData" />
    <xsl:param name="columnWidth" />
    <xsl:variable name="currentRow" select="." />
    <tr style="font-size:9pt;">
      <xsl:for-each select="$fieldData">
        <td width="{$columnWidth}%">
          <xsl:attribute name="align">
            <xsl:choose>
              <xsl:when test="s:datatype/@dt:type = 'string'">
                <xsl:value-of select="'left'" />
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="'right'" />
              </xsl:otherwise>
            </xsl:choose>
          </xsl:attribute>
          <xsl:variable name="currentData" select="$currentRow/@*[name() = 
current()/@name]" />
          <xsl:choose>
            <xsl:when test="$currentData != ''">
              <xsl:choose>
                <xsl:when test="s:datatype/@rs:dbtype = 'currency'">
                  <xsl:value-of select="format-number($currentData, '#,##0')" />
                </xsl:when>
                <xsl:when test="s:datatype/@rs:dbtype = 'timestamp'">
                  <xsl:value-of select="concat(substring($currentData, 9, 2), 
'/', substring($currentData, 6, 2), '/', substring($currentData, 14))" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="$currentData" />
                </xsl:otherwise>
              </xsl:choose>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="'&#xa0;'" />
            </xsl:otherwise>
          </xsl:choose>
        </td>
      </xsl:for-each>
    </tr>
  </xsl:template>
</xsl:stylesheet>

-- 

Joe (MVP - XML)

https://mvp.support.microsoft.com/profile=8AA9D5F5-E1C2-44C7-BCE8-8741D22D17A5 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent