W3C home > Mailing lists > Public > www-xsl-fo@w3.org > June 2011

Re: XSLFO WYSIWYG designer

From: G. Ken Holman <gkholman@CraneSoftwrights.com>
Date: Wed, 08 Jun 2011 16:31:49 -0400
Message-Id: <>
To: www-xsl-fo@w3.org
At 2011-06-08 14:01 -0400, I wrote:
>At 2011-06-08 09:38 -0700, ricky_leo wrote:
>>I am trying to create XSLFO WYSIWYG designer which is more suitable to my
>Wow!  I wish you luck.  I think that is an 
>ambitious project.  Perhaps too ambitious.
>What is your frame of reference?  Are you 
>creating final-form documents simply for 
>rendering, or are you creating a transformation 
>specification for XSLT to translate an arbitrary input into an XSL-FO output?
>If the latter, remember that XSLT is Turing 
>complete, meaning it is a full programming 
>language providing arbitrary transformation 
>capability.  How will you be able to frame your 
>users' arbitrary requirements in a graphical interface?

If you are planning to create XSLT stylesheets 
for XSL-FO, and not simply final-form XSL-FO 
documents, one tool you might find handy is my 
LiterateXSLT environment freely available from here:


If you create a pro-forma XSL-FO result with the 
appearance that you want, and you seed that 
pro-forma document with LiterateXSLT citations of 
XPath addresses, then my environment will 
synthesize the XSLT stylesheet you then use in 
production.  My vocabulary is primarily made up 
of attributes used to decorate a pro-forma 
result, though there are a few elements in there as well.

Because an XSL-FO processor is tolerant of 
foreign elements and foreign attributes, one can 
preview the pro-forma XSL-FO instance even when 
it is decorated with LiterateXSLT components.

Consider this pro-forma XSL-FO instance:

~/z/data/kendata/dev/literate $ cat hello.fo
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="http://www.w3.org/1999/XSL/Format"
             margin-right="15mm" margin-left="15mm"
             margin-bottom="15mm" margin-top="15mm"
             page-width="210mm" page-height="297mm"
       <region-body region-name="bookpage-body"
             margin-bottom="5mm" margin-top="5mm" />
   <page-sequence master-reference="bookpage" x:match="greetings">
     <flow flow-name="bookpage-body">
       <block x:match="greeting" x:content-apply="" space-after="1em"
         The content of greeting goes here!
       <block x:see="each-greeting" space-after="1em">
         More here
       <block x:see="each-greeting" space-after="1em">
         More here
~/z/data/kendata/dev/literate $

You can run that through an XSL-FO processor and 
review the appearance of all of the constructs.

You can see on that block element a number of 
LiterateXSLT attributes, where for example the 
x:match="greeting" expresses a match attribute 
with an XPath address for an element named 
<greeting>.  When you run the above instance 
through an XSLT 2 processor, you create an XSLT stylesheet:

~/z/data/kendata/dev/literate $ xslt2 hello.fo Crane-LiterateXSLT.xsl hello.xsl
~/z/data/kendata/dev/literate $ cat hello.xsl
<?xml version="1.0" encoding="UTF-8"?>
<!--Stylesheet synthesized using the LiterateXSLT(TM) environment.-->
<!--See http://www.CraneSoftwrights.com/links/res-lxslt.htm for available-->
<!--resources, training and training materials from Crane Softwrights Ltd.-->

<xsl:stylesheet xmlns="http://www.w3.org/1999/XSL/Format"
    <xsl:output indent="no"/>
    <xsl:template match="/">
       <root font-size="16pt">
margin-right="15mm" margin-left="15mm" margin-bottom="15mm" margin-top="15mm"
region-name="bookpage-body" margin-bottom="5mm" margin-top="5mm"/>
          <xsl:apply-templates select="greetings"/>
    <xsl:template match="greetings">
       <page-sequence master-reference="bookpage">
          <flow flow-name="bookpage-body">
             <xsl:apply-templates select="greeting"/>
    <xsl:template match="greeting" name="each-greeting">
       <block space-after="1em">
</xsl:stylesheet>~/z/data/kendata/dev/literate $

Next, take some XML data geared to the XPath 
addresses you used with LiterateXSLT ... this 
would be an example of production data:

~/z/data/kendata/dev/literate $ cat hello.xml
<?xml version="1.0" encoding="iso-8859-1"?>
    <greeting xml:lang="en">Hello! / Hi!</greeting>
    <greeting xml:lang="fr">Salut / Bonjour</greeting>
    <greeting xml:lang="sq">C'kemi</greeting>
    <greeting xml:lang="bg">Zdravei</greeting>
    <greeting xml:lang="ca">Ei !</greeting>
    <greeting xml:lang="da">Hej</greeting>
    <greeting xml:lang="nl">Hallo / Hoi</greeting>
    <greeting xml:lang="et">Tere</greeting>
    <greeting xml:lang="fi">Hei</greeting>
    <greeting xml:lang="gl">Ola</greeting>
    <greeting xml:lang="de">Hallo / Guten Tag / Gr?? Gott</greeting>
    <greeting xml:lang="el">Geia sou</greeting>
    <greeting xml:lang="hu">Szia</greeting>
    <greeting xml:lang="is">Hall?</greeting>
    <greeting xml:lang="ga">Dia dhuit</greeting>
    <greeting xml:lang="it">Ciao / Salve</greeting>
    <greeting xml:lang="lv">Latvia</greeting>
    <greeting xml:lang="lt">Lithuania</greeting>
    <greeting xml:lang="mk">Zdravo</greeting>
    <greeting xml:lang="no">Hei / Hallo</greeting>
    <greeting xml:lang="pt">Ol?</greeting>
    <greeting xml:lang="sh">Zdravo / Bok</greeting>
    <greeting xml:lang="sl">Slovenia</greeting>
    <greeting xml:lang="es">Hola</greeting>
    <greeting xml:lang="sv">Hej</greeting>
    <greeting xml:lang="tr">Merhaba</greeting>
~/z/data/kendata/dev/literate $

Now, run that through the stylesheet you created 
with LiterateXSLT and you end up with an XSL-FO 
instance ready for publishing (I've indented it 
just to make it readable in this posting):

~/z/data/kendata/dev/literate $ xslt2 hello.xml hello.xsl hello-out.fo
~/z/data/kendata/dev/literate $ indent hello-out.fo
~/z/data/kendata/dev/literate $ cat hello-out.fo
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="http://www.w3.org/1999/XSL/Format" font-size="16pt">
       <simple-page-master margin-right="15mm" 
margin-left="15mm" margin-bottom="15mm" margin-top="15mm"
region-name="bookpage-body" margin-bottom="5mm" margin-top="5mm"/>
    <page-sequence master-reference="bookpage">
       <flow flow-name="bookpage-body">
          <block space-after="1em">Hello! / Hi!</block>
          <block space-after="1em">Salut / Bonjour</block>
          <block space-after="1em">C'kemi</block>
          <block space-after="1em">Zdravei</block>
          <block space-after="1em">Ei !</block>
          <block space-after="1em">Hej</block>
          <block space-after="1em">Hallo / Hoi</block>
          <block space-after="1em">Tere</block>
          <block space-after="1em">Hei</block>
          <block space-after="1em">Ola</block>
          <block space-after="1em">Hallo / Guten Tag / Grüß Gott</block>
          <block space-after="1em">Geia sou</block>
          <block space-after="1em">Szia</block>
          <block space-after="1em">Halló</block>
          <block space-after="1em">Dia dhuit</block>
          <block space-after="1em">Ciao / Salve</block>
          <block space-after="1em">Latvia</block>
          <block space-after="1em">Lithuania</block>
          <block space-after="1em">Zdravo</block>
          <block space-after="1em">Hei / Hallo</block>
          <block space-after="1em">Olá</block>
          <block space-after="1em">Zdravo / Bok</block>
          <block space-after="1em">Slovenia</block>
          <block space-after="1em">Hola</block>
          <block space-after="1em">Hej</block>
          <block space-after="1em">Merhaba</block>
</root>~/z/data/kendata/dev/literate $

So, if in your GUI your user builds up a 
pro-forma XSL-FO instance with constructs that 
are reproduced by input from your XML, and they 
decorate those constructs with LiterateXSLT 
attributes, they will be able to export a 
functioning XSLT stylesheet for their users to then use with production data.

I developed LiterateXSLT specifically with XSL-FO 
in mind, though it works with HTML or any 
vocabulary.  I needed a way to synthesize 
stylesheets for instances of OASIS Universal 
Business Language (UBL).  So it wasn't just a 
theoretical exercise ... it solves a real problem 
of how to do stylesheet synthesis.  I have users 
using LiterateXSLT to create instance translators 
from one XML vocabulary to another XML vocabulary.

Being a free download, I don't know everywhere it is being used.

What I haven't done is tried to envision a GUI 
for LiterateXSLT.  I'll leave that with others more capable than I.

I hope this is helpful.

. . . . . . . . . . . . Ken

Contact us for world-wide XML consulting & instructor-led training
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/f/
G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal
Received on Wednesday, 8 June 2011 20:32:37 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:35 UTC