Welcome Guest, you are in: Login

Daisley-Harrison Software

RSS RSS

Navigation




Search the wiki
»
Below is an example of each function that can be called in the context extension object. The extension object gives the Xslt template almost complete access to the screwturn wiki plugin API.

NOTE this "uber" transform should be used as an example only, and should not be executed on a wiki containing more that a few pages.




<?xml version="1.0" encoding="utf-8"?>
<?markup 
 namespace DumpWikiContext;
 formatting-phase dynamic;
 syntax wiki;
 author "Aaron G. Daisley-Harrison";
 copyright "&copy; Copyright 2009 - Daisley-Harrison Software";
 support-url http://support.daisley-harrison.com/wiki/Support.XsltMarkupPlugin.ashx;
 ?>
<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:wiki="http://daisley-harrison.com/namespaces/screwturnwiki/xsltmarkupplugin/wiki-context">
  <xsl:output method="html" indent="yes"/>
  <xsl:param name="match-number"/>
  <xsl:param name="base-uri"/>
  <xsl:param name="unnamed-parameter-0"/>
  <xsl:param name="all-parameters"/>
  <xsl:include href="ExampleHelpers.xslt"/>
  <xsl:template match="/">
    <h1>Dump Of wiki-content Namespace</h1>
    wiki:FormattingPhase() = <xsl:value-of select="wiki:FormattingPhase()"/><br/>
    wiki:IsForIndexing() = <xsl:value-of select="wiki:IsForIndexing()"/><br/>
    wiki:IsForWysiwyg() = <xsl:value-of select="wiki:IsForWysiwyg()"/><br/>
    wiki:SecurityContext() = <xsl:value-of select="wiki:SecurityContext()"/><br/>
    <table>
      <tr>
        <th>
          wiki:MarkupParameters()
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:MarkupParameters()"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <table>
      <tr>
        <th>
          wiki:CurrentUser()
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:CurrentUser()"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <table>
      <tr>
        <th>
          wiki:CurrentPage()
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:CurrentPage()"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    wiki:CurrentNamespaceName() = <xsl:value-of select="wiki:CurrentNamespaceName()"/><br/>
    <table>
      <tr>
        <th>
          wiki:Users()
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:Users()"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <table>
      <tr>
        <th>
          wiki:User('fubar')
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:User('fubar')"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <table>
      <tr>
        <th>
          wiki:UserGroups()
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:UserGroups()"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    wiki:IsUserInGroup(wiki:CurrentUser()/name,'Administrators') = <xsl:value-of select="wiki:IsUserInGroup(wiki:CurrentUser(),'Administrators')"/><br/>
    wiki:IsUserInGroup(wiki:CurrentUser()/name,'fubar') = <xsl:value-of select="wiki:IsUserInGroup(wiki:CurrentUser(),'fubar')"/><br/>
    wiki:IsCurrentUserInGroup('fubar') = <xsl:value-of select="wiki:IsCurrentUserInGroup('fubar')"/><br/>
    wiki:IsCurrentUserInGroup('Administrators') = <xsl:value-of select="wiki:IsCurrentUserInGroup('Administrators')"/><br/>
    <xsl:variable name="current-page-name" select="wiki:CurrentPage()/@name"/>
    <table>
      <tr>
        <th>
          wiki:Namespaces()
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:Namespaces()"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <xsl:variable name="pages" select="wiki:Pages('')"/>
    <table>
      <tr>
        <th>
          wiki:Pages('')
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="$pages"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <xsl:variable name="page3-name" select="$pages/page[3]/@name"/>
    $pages/page[3]/@name = <xsl:value-of select="$page3-name"/><br/>
    <table>
      <tr>
        <th>
          wiki:PageContent('<xsl:value-of select="$page3-name"/>')
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:PageContent($page3-name)"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <xsl:variable name="page3-backups" select="wiki:Revisions($page3-name)"/>
    <table>
      <tr>
        <th>
          wiki:Revisions('<xsl:value-of select="$page3-name"/>')
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="$page3-backups"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <table>
      <tr>
        <th>
          wiki:BackupContent('<xsl:value-of select="$page3-name"/>', <xsl:value-of select="$page3-backups/revision[2]"/>)
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:BackupContent($page3-name,$page3-backups/revision[2])"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <hr/>

    <table>
      <tr>
        <td>wiki:Format('[Silverlight-plug-in-test]') = </td>
        <td>
          <xsl:value-of select="wiki:Format('[Silverlight-plug-in-test]')"/>
        </td>
      </tr>
    </table>
    <hr/>
    <table>
      <tr>
        <th>
          wiki:FormatterProviders()
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:FormatterProviders()"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <hr/>
    <table>
      <tr>
        <th>
          wiki:PagesStorageProviders()
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:PagesStorageProviders()"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <hr/>
    <table>
      <tr>
        <th>
          wiki:FilesStorageProviders()
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:FilesStorageProviders()"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <hr/>
    <table>
      <tr>
        <th>
          wiki:CacheProviders()
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:CacheProviders()"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <hr/>
    <table>
      <tr>
        <th>
          wiki:UsersStorageProviders()
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:UsersStorageProviders()"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <hr/>
    <table>
      <tr>
        <th>
          wiki:SettingsStorageProvider()
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:SettingsStorageProvider()"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <hr/>
    <table>
      <tr>
        <th>
          wiki:ProviderConfiguration('DaisleyHarrison.ScrewturnWiki.XsltMarkupPlugin.XsltMarkupPlugin')
        </th>
        <td>
          <textarea rows="20" cols="80" readonly="true">
            <xsl:value-of select="wiki:ProviderConfiguration('DaisleyHarrison.ScrewturnWiki.XsltMarkupPlugin.XsltMarkupPlugin')"/>
          </textarea>
        </td>
      </tr>
    </table>
    <table>
      <tr>
        <th>
          wiki:Directories('/')
        </th>
      </tr>
      <tr>
        <td>
          <xsl:call-template name="show-node-as-xml">
            <xsl:with-param name="node" select="wiki:Directories('/')"/>
          </xsl:call-template>
        </td>
      </tr>
    </table>
    <hr/>
    <hr/>
    wiki:SettingValue('WikiTitle') = <xsl:value-of select="wiki:SettingValue('WikiTitle')"/><br/>
    wiki:Language() = <xsl:value-of select="wiki:Language()"/><br/>
    wiki:Directories('/') = <xsl:value-of select="wiki:Directories('/')"/><br/>
    wiki:Directories('/SPInterfaceUserGuide/') = <xsl:value-of select="wiki:Directories('/SPInterfaceUserGuide/')"/><br/>
    wiki:Directories('/SPInterfaceUserGuide/TestA/') = <xsl:value-of select="wiki:Directories('/SPInterfaceUserGuide/TestA/')"/><br/>
    wiki:Directories('/SPInterfaceUserGuide/TestA/') = <xsl:value-of select="wiki:Directories('/SPInterfaceUserGuide/TestA/')"/><br/>
    wiki:Files('/SPInterfaceUserGuide/TestA/TestB/') = <xsl:value-of select="wiki:Files('/SPInterfaceUserGuide/TestA/TestB/')"/><br/>
    wiki:Files('/SPInterfaceUserGuide/') = <xsl:value-of select="wiki:Files('/SPInterfaceUserGuide/')"/><br/>
    wiki:FileExists('/SPInterfaceUserGuide/AddReferenceA.png') = <xsl:value-of select="wiki:FileExists('/SPInterfaceUserGuide/AddReferenceA.png')"/><br/>
    wiki:File('/SPInterfaceUserGuide/AddReferenceA.png','fullname') = <xsl:value-of select="wiki:File('/SPInterfaceUserGuide/AddReferenceA.png','fullname')"/><br/>
    wiki:File('/SPInterfaceUserGuide/AddReferenceA.png','lastmodified') = <xsl:value-of select="wiki:File('/SPInterfaceUserGuide/AddReferenceA.png','lastmodified')"/><br/>
    wiki:File('/SPInterfaceUserGuide/AddReferenceA.png','retrievalcount') = <xsl:value-of select="wiki:File('/SPInterfaceUserGuide/AddReferenceA.png','retrievalcount')"/><br/>
    wiki:File('/SPInterfaceUserGuide/AddReferenceA.png','size') = <xsl:value-of select="wiki:File('/SPInterfaceUserGuide/AddReferenceA.png','size')"/><br/>
    <xsl:message>This message is written to the screwturn wiki log!</xsl:message>
  </xsl:template>
    <xsl:template match="@* | node()">
        <xsl:copy>
            <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>







Please visit our blog at http://blog.daisley-harrison.com

- All Content © Copyright 2010 Daisley-Harrison Software - All Rights Reserved. - ScrewTurn Wiki version 3.0.1.400.