Author:
Allen
Version:
1.0
Release Date:
2 May 2009
Category:
Output

Description

This is a "starter" utility that replicates the functionality of <xsl:copy-of> but with the added ability to allow for template authors to add matching template overrides to the HTML data in the XML source. It's known within the Symphony community as The Ninja Technique.

XSLT

View Raw
<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!--
Name: HTML Manipulation
Version: 1.0
Author: Allen Chang <allen@chaoticpattern.com>
URL: http://symphony21.com/downloads/xslt/file/20035/

Description:
This is the starter utility (dubbed "The Ninja Technique") in which all awesome HTML manipulation works off.
Be sure to check out http://chaoticpattern.com/article/manipulating-html-in-xml/ for more info.

Usage:
1. Invoke the HTML output using: <xsl:apply-templates select="path/to/your/body/*" mode="html"/>.
2. Write your own overriding matching templates to manipulate the HTML.
-->

<xsl:template match="*" mode="html">
	<xsl:element name="{name()}">
		<xsl:apply-templates select="* | @* | text()" mode="html"/>
	</xsl:element>
</xsl:template>

<xsl:template match="@*" mode="html">
	<xsl:attribute name="{name()}">
		<xsl:value-of select="."/>
	</xsl:attribute>
</xsl:template>

</xsl:stylesheet>

Discuss this XSLT Utility

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details