May 17, 2013

Identity XSL for SharePoint XSLT Webpart

When you get started with XSL transforms with the SharePoint XSLT Webpart, a visual identity XSL transform is often helpful for getting started.

Here's one I made:

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="msxsl"
  xmlns:ddwrt2="urn:frontpage:internal">
<xsl:output method="html" />
<xsl:template match='dsQueryResponse'>
   <fieldset>
   <legend><xsl:text>dsQueryResponse</xsl:text></legend>
   <dl title="dsQueryResponse">
           <xsl:for-each select="@*">
    <dt><xsl:value-of select="name()"/></dt>
      <dd><xsl:value-of select="."/></dd>
  </xsl:for-each>
  </dl>
 


<fieldset>
   <legend><xsl:text>Rows</xsl:text></legend>

    

     <xsl:apply-templates select='Rows/Row'/>
     </fieldset>
    
     </fieldset>

  
  </xsl:template>

 
  <xsl:template match='Row'>
<fieldset>
   <legend><xsl:text>Row</xsl:text></legend>

  <dl>
             <xsl:for-each select="@*">
   <dt><xsl:value-of select="name()"/></dt>   
   <dd><xsl:value-of select="."/></dd>
  </xsl:for-each>
  </dl>
  </fieldset>
    
  </xsl:template>
 

</xsl:stylesheet>

No comments:

Post a Comment