• Get the Flash Player to see the slideshow.
  • Categories

  • Authors

  • Great Quotes

    Ruby inherited the Perl philosophy of having more than one way to do the same thing. I inherited that philosophy from Larry Wall, who is my hero actually. I want to make Ruby users free. I want to give them the freedom to choose. — Yukihiro Matsumoto - inventor of Ruby

Get in touch...

To have a chat about
your CMS needs...

Call us 0207 193 2014
or
Email us on

Archive for the ‘XSL’ Category

Use Sablotron with Expat to test XSL locally and quickly

Wednesday, July 23rd, 2008
  1. Download Windows Sablotron zip file from http://www.gingerall.org/sablotron.html
  2. Download Windows Expat parser from
    http://downloads.sourceforge.net/expat/expat-win32bin-2.0.1.exe?modtime=1181069764&big_mirror=0
  3. Unzip Sablotron to c:\sab
  4. Install Expat
  5. Browse to Expat dir and copy all files in bin directory to c:\sab\bin
  6. Check it works with “c:\sab\bin\sabcmd.exe –help”
  7. Start testing your XSL scripts as per the step below
  8. c:\sab\bin\sabcmd.exe mytemplates.xsl mysource.xml myoutput.html
  9. That’s it! Have fun :-)

Create HTML Currency Entity References in XSL

Wednesday, July 23rd, 2008

Example XSL Sheet Below (Note, for each CURRENCY element found, the full set of available currency symbols is rendered. This is just for the example. The key line is :-

<pre lang=”xsl”>

<xsl:text disable-output-escaping=”yes”>€</xsl:text>

</pre>

<pre lang=”xsl”>

<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform“>

<xsl:apply-templates />

<xsl:template match=”CURRENCY”>
<xsl:call-template name=”currency_symbol”>
<xsl:with-param name=”iso_code”>GBP</xsl:with-param>
</xsl:call-template>
<xsl:call-template name=”currency_symbol”>
<xsl:with-param name=”iso_code”>EUR</xsl:with-param>
</xsl:call-template>
<xsl:call-template name=”currency_symbol”>
<xsl:with-param name=”iso_code”>JPY</xsl:with-param>
</xsl:call-template>
<xsl:call-template name=”currency_symbol”>
<xsl:with-param name=”iso_code”>USD</xsl:with-param>
</xsl:call-template>

</xsl:template>

<xsl:template name=”currency_symbol”>
<xsl:param name=”iso_code”/>
<xsl:choose>
<xsl:when test=”$iso_code=’JPY’”>
<xsl:text disable-output-escaping=”yes”>¥</xsl:text>
</xsl:when>
<xsl:when test=”$iso_code=’EUR’”>
<xsl:text disable-output-escaping=”yes”>€</xsl:text>
</xsl:when>
<xsl:when test=”$iso_code=’USD’”>
<xsl:text disable-output-escaping=”yes”>$</xsl:text>
</xsl:when>
<xsl:when test=”$iso_code=’GBP’”>
<xsl:text disable-output-escaping=”yes”>£</xsl:text>
</xsl:when>
<xsl:otherwise>
NoSymbol
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>

</pre>

LiveSite XSL Reference

Wednesday, July 2nd, 2008

The idea with this page is to capture all the useful LiveSite XSL syntax for use in the Appearance XSL of a component. This way you can be lazy :)

Select Values

Select a basic datum:

<xsl:value-of select=”/Properties/Data/Datum[@Name='Message']“/>

Admin Switch

This is used in the component to determine if it is being viewed from within TeamSite or the LiveSite runtime.

When “Admin=true” the component is being viewed in TeamSite.
<xsl:choose>
<xsl:when test=”/Properties[@Admin='true']“>
<h1>Hello I am being viewed in TeamSite</h1>
</xsl:when>
<xsl:otherwise>
<h1> Hello I am being viewed on the Runtime server</h1>
</xsl:otherwise>
</xsl:choose>

Create a Variable

<xsl:variable name=”branchName” select=”/Properties/Data/External/branch”/>

Reference a variable

<xsl:value-of select=”$branchName”/>

Write a Comment

<xsl:comment>Start SSI</xsl:comment>

Text

<xsl:text disable-output-escaping = “yes”>my text</xsl:text>

CDATA – can never remember this :)

<![CDATA[ ]]>

Write Include Tag

<xsl:text disable-output-escaping = “yes”>
<jsp:include page=”ShowDCR.jsp”></jsp:include>
</xsl:text>

Create a Hyperlink

<li>
<a>
<xsl:attribute name=”href”>
<xsl:text>$URL_PREFIX/</xsl:text>
<xsl:value-of select=”/Properties/Data/Datum[@Name='Link Target']“/>
</xsl:attribute>
<xsl:value-of select=”/Properties/Data/Datum[@Name='Link Title']“/>
</a>
</li>