Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom Steer 24 posts 44 karma points
    May 02, 2012 @ 19:54
    Tom Steer
    0

    Dynamic Grid Datatype - Macro

    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

  • Grant 21 posts 61 karma points
    Dec 02, 2013 @ 00:25
    Grant
    0

    Thanks Tommy, where would I put in my column names?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies