Tricks and tips

Revision as of 17:15, 4 April 2007 by Claratte (Talk | contribs)

Jump to: navigation, search

SQL

Permut two rows according to their id

Goal: permut two rows with id=a and id=b using only one query

UPDATE some_table SET id = a + ABS(id - b) WHERE order_num in (a , b)

XSLT

Permit php function call

 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  version="1.0" 
  xmlns:php="http://php.net/xsl"
  exclude-result-prefixes="xhtml php">
 

then:

<xsl:value-of select="php:functionString('_tr8', //something/forexample)"/>