Quantcast
Channel: ActiveTopics
Viewing all articles
Browse latest Browse all 72689

Dynamic Grid Datatype - Macro

$
0
0

Hey Guys,

I thought I would post some XSLT I wrote for the "Dynamic Grid" Datatype as I couldn't find a macro for it to output the table. This is my first XSLT file so it probably could probably be improved but thought I would post it just in case it could save anyone else some time :)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:msxml="urn:schemas-microsoft-com:xslt"
  xmlns:umbraco.library="urn:umbraco.library"
  exclude-result-prefixes="msxml umbraco.library">

<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:param name="currentPage"/>


<xsl:template match="/">
  
  <table>
    <xsl:for-each select="$currentPage/tableData/Data/*[1]">
      <thead>
        <xsl:for-each select="./*">
            <th>
              <xsl:value-of select="@caption"/>
            </th>
          </xsl:for-each>
      </thead>
    </xsl:for-each>
    <tbody>
      <xsl:for-each select="$currentPage/tableData/Data/*">
       <tr>
          <xsl:for-each select="./*">
            <td>
              <xsl:value-of select="."/>
            </td>
          </xsl:for-each>
        </tr>
      </xsl:for-each>
    </tbody>
  </table>
 
</xsl:template>
    
</xsl:stylesheet>

Tommy


Viewing all articles
Browse latest Browse all 72689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>