The easy Weblog and Wiki Software
[ start | index | login ]
start > xslt extension function

xslt extension function

Created by mdubinko. Last edited by mdubinko, 5 years and 187 days ago. Viewed 780 times. #1
[edit] [rdf]
labels
attachments
Here's a useful hack:

Grab the Radeox sources and make a class like this:

package org.radeox.example;

import org.radeox.engine.context.RenderContext; import org.radeox.engine.context.BaseRenderContext; import org.radeox.EngineManager;

/** * Created by IntelliJ IDEA. * User: mdubinko * Date: Feb 22, 2003 * Time: 5:24:13 PM * To change this template use Options | File Templates. */ public class Renderer { public Renderer() { } // needed for recognition as extension class?

public static String render(String arg) {

if (arg == null) arg = "whatever sample snip you want here";

RenderContext context = new BaseRenderContext(); return (EngineManager.getInstance().render(arg, context)); } }

Hmm, ought to make RenderContext static.. Anyway, with a recompiled radeox.jar in the classpath, Java XSLT engines like Saxon can then do this:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:radeox="http://snipsnap.org/org.radeox.example.Renderer">
…
<xsl:template match="content">
  <content><xsl:value-of select="radeox:render(.)" disable-output-escaping="yes"/></content>
</xsl:template>
…
</xsl:stylesheet>

I hereby contribute the content of this snip to the public domain, for anyone to use for any purpose. -m

9 comments (by Davor, mdubinko, funzel) | post comment

What is SnipSnap?
SnipSnap is a free and easy to install weblog and wiki tool written in Java.

SnipSnap download
Current version: 1.0b3-uttoxeter
Try our >>Web Start Demo!

Resources

5567 Users and 13713 Snips. Installed 6 years and 49 days ago

Logged in Users: (2)
… and 14 Guests.

snipsnap-changed for older changes.

< August 2008 >
SunMonTueWedThuFriSat
12
3456789
10111213141516
17181920212223
24252627282930
31

snipsnap
Listed on BlogShares
XHTML 1.0 validated
CSS validated
RSS 2.0 validated
RSS Feed

pico-powered

Powered by SnipSnap 1.0b3-uttoxeter
YourKit >>Java Profiler

Fraunhofer FIRST

snipsnap.org | Copyright 2000-2006 Fraunhofer FIRST