Wiki

Clone wiki

confluence-xslt-processor-plugin / Home

XSLT Processor Plugin for Confluence

The XSLT Processor Plugin for Confluence allows to transform the storage format of a Confluence page using XSLT templates.

Features

  • Create, update, delete named XSLT templates in the administration area
  • Perform an XSL transformation on the storage format of a specific Confluence page calling a designated URL
  • Secured actions, permission checks are applied to the actions

Usage / Examples

First of all you need an XSLT template that will be applied to a Confluence pages storage format.

An example:

In a fresh installed Confluence there is always the Demonstration Space containing some basic input. Let's say we want to transform the page named "Tutorial" and extract a list of titles that is encapsuled in strong-tags there

The first step is to take a look at the page in the storage format. This is done on the page, use the page menu and click on Tools -> View Storage Format

This is the storage format:

<ac:macro ac:name="section">
    <ac:rich-text-body>
        <ac:macro ac:name="column">
            <ac:parameter ac:name="width">60%</ac:parameter>
            <ac:rich-text-body>
                <p>This tutorial will help you get started with Confluence:</p>
                <ac:macro ac:name="children">
                    <ac:parameter ac:name="style">h5</ac:parameter>
                </ac:macro>
                <p>
                    <br class="atl-forced-newline" />
                    <br class="atl-forced-newline" />
                    <ac:link>
                        <ri:page ri:content-title="Using the Dashboard" />
                        <ac:link-body>
                            <ac:image>
                                <ri:attachment ri:filename="btn_next.png">
                                    <ri:page ri:content-title="_Images" />
                                </ri:attachment>
                            </ac:image>
                        </ac:link-body>
                    </ac:link>
                </p>
            </ac:rich-text-body>
        </ac:macro>
        <ac:macro ac:name="column">
            <ac:rich-text-body>
                <ac:macro ac:name="info">
                    <ac:parameter ac:name="icon">false</ac:parameter>
                    <ac:rich-text-body>
                        <p>
                            <strong>What is a space?</strong>
                            <br />
                            A space is an area within Confluence, containing your wiki pages.
                            You can think of each space as a sub-site, or mini-site, each
                            with its own home page.
                        </p>
                        <p>
                            <strong>What is the Dashboard?</strong>
                            <br />
                            The Dashboard is the home page of your Confluence wiki. The
                            Dashboard contains a list of all the spaces within your wiki, as
                            well as a list of recently updated content.
                        </p>
                        <p>
                            <strong>What is a wiki?</strong>
                            <br />
                            A wiki is a piece of software that allows you and your colleagues
                            to create and edit web pages quickly and simply. Just click, edit
                            and save. Content is published immediately.
                        </p>
                        <p>
                            <strong>What is Confluence?</strong>
                            <br />
                            Confluence is an enterprise wiki with some extra communication
                            tools, including blog posts and RSS feeds.
                        </p>
                        <p>
                            <strong>What makes Confluence an enterprise wiki?</strong>
                            <br />
                            Different organisations use Confluence for different purposes: as
                            a company intranet, corporate website, project workspace,
                            knowledge base, documentation site and a host of other
                            implementations. All these are made possible by Confluence's
                            enterprise-appropriate features, including: security permissions
                            at the page, space and site level; content structuring and
                            restructuring options; LDAP compatibility and more.
                        </p>
                        <p>
                            <ac:emoticon ac:name="tick" />
                            If you prefer, read the tutorial
                            <ac:link>
                                <ri:page ri:content-title="Tutorial (all on one page)" />
                                <ac:plain-text-link-body><![CDATA[on one page]]></ac:plain-text-link-body>
                            </ac:link>
                            .
                        </p>
                    </ac:rich-text-body>
                </ac:macro>
            </ac:rich-text-body>
        </ac:macro>
    </ac:rich-text-body>
</ac:macro>

And this is the XSL template:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ac="http://atlassian.com" xmlns:ri="http://atlassian2.com" exclude-result-prefixes="ac ri">
    <xsl:output method="html" encoding="UTF-8" />
    <xsl:template match="/">
        <xsl:for-each select="//ac:rich-text-body//strong">
            <xsl:value-of select="."></xsl:value-of>
            <xsl:text>&#xa;</xsl:text>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>

When you open the address corresponding to the saved XSL template and the page's id in your browser you should see a list of elements as shown in the following screenshots.

Screenshots

Managing XSLT Templates

Managing XSLT Templates

Template saved

XSL Transformation applied to a Confluence page

XSL Template applied

Security hints

Security hints

Issue Tracker

Please feel free to use the issuetracker to post proposals, feature requests or bugs!

Author

Please feel free to have a look at my blog at www.hascode.com or at the other plugins of mine on the Atlassian Marketplace.


2013 Micha Kops / hasCode.com

Updated