swebb 0 Newbie Poster

Hi all,

I'm working with xsl-fo at the moment to create an interactive document. One of the features which I would like to implement is <fo:multi-switch>, <fo:multi-case> and <fo:multi-toggle>. I am using the Apache FOP processor and have discovered that it doesn't support these elements. I researched a few other processors and found that they don't support them either. www.w3.org (http://www.w3.org/TR/xsl/#d0e12855) provide an example of these elements but I can't find any other examples.

Below is the stylesheet which I modified from the w3.org example to include the fo:root but it doesn't output the image or create the toggle (expand, contract) effect that I am looking for, I am assuming it doesn't do this because <fo:multi-switch> etc. is not supported?

I found this site which does a comparison of a few of the fo processors available and the elements they support - http://www.antennahouse.com/xslfo/impl-comparison-fo.htm and none of them include the multi-switch

Any thoughts or recommendations on this are greatly appreciated, thanks for listening.

S.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    version="1.0">
    
    <xsl:template match="/">
        <fo:root>
            <fo:layout-master-set>
                <fo:simple-page-master master-name="front">
                    <fo:region-body region-name="xsl-region-body" page-height="29.7cm" page-width="21cm"/>
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence master-reference="front">
                <fo:flow flow-name="xsl-region-body">
                    <fo:block><xsl:apply-templates/></fo:block>
                </fo:flow>
            </fo:page-sequence>
        </fo:root>
        
    </xsl:template>
    
    
    
    <xsl:template match="title">
        <fo:block>
            <xsl:value-of select="."/>
            <fo:multi-switch>
                <fo:multi-case case-name="test" case-title="test">
                    <fo:multi-toggle switch-to="test2">
                        <fo:inline>
                            <fo:external-graphic src="screen-capture-1.png"/>
                        </fo:inline>
                    </fo:multi-toggle>
                </fo:multi-case>
                <fo:multi-case case-name="test2" case-title="test2" starting-state="hide">
                    <fo:multi-toggle switch-to="test">
                        <fo:inline>
                            <fo:external-graphic src="screen-capture-2.png"/>
                        </fo:inline>
                    </fo:multi-toggle>
                </fo:multi-case>
            </fo:multi-switch>
            
        </fo:block>
        
        
    </xsl:template>
    
</xsl:stylesheet>

The target document

<?xml version="1.0" encoding="UTF-8"?>
<doc>
    <chapter><title>Chapter</title>
        <p>Text</p>
        <section><title>Section</title>
            <p>Text</p>
            <extra>Some extra text here...</extra>
        </section>
        <section><title>Section</title>
            <p>Text</p>
        </section>
    </chapter>
    <chapter><title>Chapter</title>
        <p>Text</p>
        <section><title>Section</title>
            <p>Text</p>
        </section>
        <section><title>Section</title>
            <p>Text</p>
        </section>
    </chapter>
</doc>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.