01: /*
02: * This file is part of "SnipSnap Wiki/Weblog".
03: *
04: * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel
05: * All Rights Reserved.
06: *
07: * Please visit http://snipsnap.org/ for updates and contact.
08: *
09: * --LICENSE NOTICE--
10: * Licensed under the Apache License, Version 2.0 (the "License");
11: * you may not use this file except in compliance with the License.
12: * You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software
17: * distributed under the License is distributed on an "AS IS" BASIS,
18: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19: * See the License for the specific language governing permissions and
20: * limitations under the License.
21: * --LICENSE NOTICE--
22: */
23: package org.radeox.example;
24:
25: import org.radeox.EngineManager;
26: import org.radeox.api.engine.context.RenderContext;
27: import org.radeox.engine.context.BaseRenderContext;
28:
29: /**
30: * An xslt extension function to render snip content using radeox. Example
31: * usage: <xsl:stylesheet version="1.0"
32: * xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
33: * xmlns:radeox="http://snipsnap.org/org.radeox.example.XSLTExtension"> É
34: * <xsl:template match="content"> <content><xsl:value-of
35: * select="radeox:render(.)" disable-output-escaping="yes"/></content>
36: * </xsl:template> É </xsl:stylesheet>
37: *
38: * @author Micah Dubinko
39: * @version $Id: XSLTExtension.java 7707 2006-04-12 17:30:19Z
40: * ian@caret.cam.ac.uk $
41: */
42: public class XSLTExtension {
43: public XSLTExtension() {
44: // needed for recognition as extension class?
45: }
46:
47: public static String render(String arg) {
48: // for maximum robustness don't put any text in that isn't there
49: if (arg == null) {
50: arg = "";
51: }
52:
53: RenderContext context = new BaseRenderContext();
54: return (EngineManager.getInstance().render(arg, context));
55: }
56: }
|