Welcome Guest, you are in: Login

Daisley-Harrison Software

RSS RSS

Navigation




Search the wiki
»

Many of the example transforms use an included file ExampleHelpers

LogThis.xslt example file


<?xml version="1.0" encoding="utf-8"?>
<?markup 
 namespace LogThis;
 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:host="http://daisley-harrison.com/namespaces/screwturnwiki/xsltmarkupplugin/host"
    xmlns:wiki="http://daisley-harrison.com/namespaces/screwturnwiki/xsltmarkupplugin/wiki-context"
    xmlns:http="http://daisley-harrison.com/namespaces/screwturnwiki/xsltmarkupplugin/http-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"/>
  <!-- this is an update   -->
  <xsl:template match="/">
    <xsl:message>
      <xsl:value-of select="$unnamed-parameter-0"/>
    </xsl:message>
  </xsl:template>
  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>



This is one of the simplest sample markukp files. The value of the first unnamed parameter in the markup is logged to the screwturn log using the standard tag.

ServerNameMarkup.xslt




<?xml version="1.0" encoding="utf-8"?>
<?markup 
 namespace ServerName;
 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;
 usage "{xsltmarkup:}";
 description "Displays the server name from the HTTP SERVER_NAME variable";
 ?>
<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"
    xmlns:http="http://daisley-harrison.com/namespaces/screwturnwiki/xsltmarkupplugin/http-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:template match="/">
    <xsl:value-of select="http:ServerVariable('SERVER_NAME')"/>
  </xsl:template>
    <xsl:template match="@* | node()">
        <xsl:copy>
            <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>


This example markup transform envokes the ServerVariable function of the markup context extension object to return the "SERVER_NAME" variable from IIS.

DumpWikiContextMarkup.xslt

This files contains examples of just about all of the calls to functions in the wiki-context namespace.

Too big for this page so moved to DumpWikiContextMarkup

DumpHttpContextMarkup.xslt

This files contains examples of just about all of the calls to functions in the http-context namespace.

Too big for this page so moved to DumpHttpContextMarkup



SilverlightMarkup.xslt example file

This is the XSLT transform used internally by the SilverlightPlugin to do it's magic. With this transform you could easily tweek the output and configure the XsltMarkupPlugin to support the same markup. Note all of the params defined, any of these parameters can be changed by specifying them as "named" parameters in the markup.


<?xml version="1.0" encoding="utf-8"?>
<?markup 
 namespace silverlight; 
 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;
 description "Embeds a Microsoft Silverlight control on a wiki page (Light up the web!)";
 usage "{silverlight: xap-file-path [ | width=nnn ] [ | height=nnn ] [ | background=color ] [ | alt=silverlight missing message] [ | autoUpgrade=true/false] }";
 ?>
<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">
    <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:param name="autoUpgrade">true</xsl:param>
  <xsl:param name="width">100%</xsl:param>
  <xsl:param name="height">100%</xsl:param>
  <xsl:param name="background">white</xsl:param>
  <xsl:param name="minRuntimeVersion">3.0.40624.0</xsl:param>
  <xsl:param name="alt">Get Microsoft Silverlight</xsl:param>
  <xsl:variable name="source-url">
    <xsl:text>GetFile.aspx?</xsl:text>
    <xsl:choose>
      <xsl:when test="substring-after($unnamed-parameter-0,'(')">
        <xsl:text>Page=</xsl:text>
        <xsl:value-of select="substring-before(substring-after($unnamed-parameter-0,'('),')')"/>
        <xsl:text disable-output-escaping="yes">&amp;File=</xsl:text>
        <xsl:value-of select="substring-after($unnamed-parameter-0,')')"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>File=</xsl:text>
        <xsl:value-of select="$unnamed-parameter-0"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:template match="/">
    <xsl:if test="$match-number=1">
      <script type="text/javascript" src="GetFile.aspx?File=Silverlight/Silverlight.js"></script>
      <script type="text/javascript">
        function onSilverlightError(sender, args) {
        var appSource = "";
        if (sender != null <xsl:text disable-output-escaping="yes">&amp;&amp;</xsl:text> sender != 0) {
        appSource = sender.getHost().Source;
        }
        var errorType = args.ErrorType;
        var iErrorCode = args.ErrorCode;
        if (errorType == "ImageError" || errorType == "MediaError") {
        return;
        }
        var errMsg = "Unhandled Error in Silverlight Application " +  appSource + "\n" ;
        errMsg += "Code: "+ iErrorCode + "    \n";
        errMsg += "Category: " + errorType + "       \n";
        errMsg += "Message: " + args.ErrorMessage + "     \n";
        if (errorType == "ParserError") {
        errMsg += "File: " + args.xamlFile + "     \n";
        errMsg += "Line: " + args.lineNumber + "     \n";
        errMsg += "Position: " + args.charPosition + "     \n";
        }
        else if (errorType == "RuntimeError") {
        if (args.lineNumber != 0) {
        errMsg += "Line: " + args.lineNumber + "     \n";
        errMsg += "Position: " +  args.charPosition + "     \n";
        }
        errMsg += "MethodName: " + args.methodName + "     \n";
        }
        throw new Error(errMsg);
        }
      </script>
    </xsl:if>
    <div id="{concat('silverlightControlHost_', $match-number)}">
      <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="{$width}" height="{$height}">
        <param name="source" value="{$source-url}"/>
        <param name="onError" value="onSilverlightError" />
        <param name="background" value="{$background}" />
        <param name="minRuntimeVersion" value="{$minRuntimeVersion}" />
        <param name="autoUpgrade" value="{$autoUpgrade}" />
        <param name="initParams" value="{$all-parameters}"/>
        <a href="http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=3.0.40624.0" style="text-decoration:none">
          <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="{$alt}" style="border-style:none"/>
        </a>
      </object>
      <iframe id="{concat('_sl_historyFrame_', $match-number)}" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
    </div>
  </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.