Intger value of String

int type = Integer.parseInt(String)

String return ""

        private String getParameter(String input)
           if(input == null || input.equals(""))
                 return "";
           else return input;

           private String getNull(String input)
           if(input == null || input.equals(""))
                 return "0";
           else return input;


esql-query loop {{{<esql:execute-query>

</esql:execute-query> }}} If your <body> element just contains text, the following templates will transform it and escape any apostrophes present, replacing them with ' character entities:

<xsl:template match="body">
        <xsl:call-template name="escape-apos">
                <xsl:with-param name="text" select="."/>

<xsl:template name="escape-apos">
<xsl:param name="text"/>
<xsl:variable name="apos">'</xsl:variable>
  <xsl:when test="contains($text, $apos)">
   <xsl:value-of select="substring-before($text, $apos)"/>
   <xsl:text disable-output-escaping="yes">&amp;apos;</xsl:text>
   <xsl:call-template name="escape-apos">
    <xsl:with-param name="text" select="substring-after($text, $apos)"/>
  <xsl:value-of select="$text"/>


Forms original by W3schools {{{<form action="form_action.xsp" method="get"> First name: <input type="text" name="fname" value="Mickey" /> <br /> Last name: <input type="text" name="lname" value="Mouse" /> <br /> <input type="submit" value="Submit" /> </form> }}} table - more "Optional Attributes" W3schools {{{<table border = "1"> <tr> <td>Cell A</td> <td>Cell B</td> </tr> </table> }}}


Match everything and apply all templates

<xsl:template match="@*|node()">
      <xsl:apply-templates select="@*|node()" />

Define a variable

<xsl:variable name="name" select="expression">
<!-- Content:template -->

Request paramteres in xsl
The "best" way (easier) is to use :

<xsl:param name="my_req_param" /> 

at the beginning of your xsl, then use it like a variable.
And in the sitemap, add to the xslt <map:transform ...> :

<map:transform ...>
<map:parameter name="use-request-parameters" value="true"/>

Testing whether certain criteria matches then apply template

<xsl:for-each select="paragraph">   
 <xsl:if test="visible = 1">  

attribute testing [@name()!='name'] with xsl:if

<xsl:if test="expression">
<!-- Content: template -->

with xsl:choose - block

        <xsl:when test=""></xsl:when>

If you test a string sometimes it is important that you don't have whitespaces!


The following XPath expression selects all the cd elements of the catalog element that have a price element:


Uppercase to lower case and vice versa

  <xsl:template match="upper-case">    
    <xsl:value-of select="translate(current(),
  <xsl:template match="lower-case">    
    <xsl:value-of select="translate(current(),
'abcdefghijklmnopqrstuvwxyz')" />

format Percent {{{ <xsl:template match="formatPercent">

  <xsl:template match="formatCurrency">    
    <xsl:value-of select="concat(current(),'$')" />

King regards
Thorsten Scherler

GETsnippets (last edited 2009-09-20 23:41:55 by localhost)