Skip to content

Instantly share code, notes, and snippets.

View mjaschen's full-sized avatar
😏
What's happening?

Marcus Jaschen mjaschen

😏
What's happening?
View GitHub Profile
<?php
do {
$iterations ++;
// hier geschehen diverse Arbeitsschritte
} while ($countCurrent < $countDesired
|| $iterations >= 5);
@mjaschen
mjaschen / gist:1576311
Created January 7, 2012 22:37
XHTML to BBCode
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" />
<xsl:template match="a"> [url=<xsl:value-of select="@href" />]<xsl:apply-templates />[/url] </xsl:template>
<xsl:template match="img"> [img]<xsl:value-of select="@src" />[/img] </xsl:template>
<xsl:template match="b|strong"> [b]<xsl:apply-templates />[/b] </xsl:template>
<xsl:template match="i|em"> [i]<xsl:apply-templates />[/i] </xsl:template>
<xsl:template match="text()"><xsl:value-of select="normalize-space(.)"/></xsl:template>
<xsl:template match="ol"> [list=1]<xsl:apply-templates />[/list] </xsl:template>
<xsl:template match="ul"> [list]<xsl:apply-templates />[/list] </xsl:template>