r591 - in trunk/jrst/src/main: java/org/nuiton/jrst resources/xsl
Author: bpoussin Date: 2011-05-25 17:42:23 +0200 (Wed, 25 May 2011) New Revision: 591 Url: http://nuiton.org/repositories/revision/jrst/591 Log: add xsl to tranform to HTML but only inner body elements (useful to integrate html result in another page) Added: trunk/jrst/src/main/resources/xsl/rst2xhtmlInnerBody.xsl Modified: trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java Modified: trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java =================================================================== --- trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java 2011-05-25 15:21:53 UTC (rev 590) +++ trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java 2011-05-25 15:42:23 UTC (rev 591) @@ -107,6 +107,8 @@ /** XSL Stylesheet to transform RST into HTML. */ protected static final String rst2xhtml = "/xsl/rst2xhtml.xsl"; + /** XSL Stylesheet to transform RST into HTML (but only inner body fragment). */ + protected static final String rst2xhtmlInnerBody = "/xsl/rst2xhtmlInnerBody.xsl"; /** XSL Stylesheet to transform RST into Xdoc. */ protected static final String rst2xdoc = "/xsl/rst2xdoc.xsl"; /** XSL Stylesheet to transform RST into Docbook. */ @@ -125,11 +127,14 @@ /** XSL Stylesheet to transform Docbook into PDF. */ protected static final String docbook2fo = "/docbook/fo/docbook.xsl"; - public static final String PATTERN_TYPE = "xml|xhtml|docbook|html|xdoc|rst|fo|pdf|odt|rtf"; + public static final String PATTERN_TYPE = "xml|xhtml|docbook|html|htmlInnerBody|xdoc|rst|fo|pdf|odt|rtf"; /** HTML output format type */ public static final String TYPE_HTML = "html"; + /** HTML output format type */ + public static final String TYPE_HTML_INNER_BODY = "htmlInnerBody"; + /** XDOC output format type */ public static final String TYPE_XDOC = "xdoc"; @@ -165,6 +170,7 @@ static { stylesheets = new HashMap<String, String>(); stylesheets.put(TYPE_HTML, rst2xhtml); + stylesheets.put(TYPE_HTML_INNER_BODY, rst2xhtmlInnerBody); stylesheets.put(TYPE_XDOC, rst2xdoc); stylesheets.put(TYPE_DOCBOOK, rst2docbook); stylesheets.put(TYPE_XHTML, rst2docbook + "," + docbook2xhtml); Copied: trunk/jrst/src/main/resources/xsl/rst2xhtmlInnerBody.xsl (from rev 589, trunk/jrst/src/main/resources/xsl/rst2xdoc.xsl) =================================================================== --- trunk/jrst/src/main/resources/xsl/rst2xhtmlInnerBody.xsl (rev 0) +++ trunk/jrst/src/main/resources/xsl/rst2xhtmlInnerBody.xsl 2011-05-25 15:42:23 UTC (rev 591) @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + JRst :: Api + + $Id$ + $HeadURL$ + %% + Copyright (C) 2004 - 2010 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + +<xsl:transform version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns="http://www.w3.org/TR/xhtml1/strict"> + + <!-- xdoc is mostly an xhtml document wrapped inside a DOCUMENT tag --> + <xsl:import href="rst2xhtml.xsl"/> + + <xsl:template match="/document"> + <xsl:apply-templates /> + </xsl:template> + +</xsl:transform> +
participants (1)
-
bpoussin@users.nuiton.org