Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSL stylesheet for export of outline from OOImpressu to HTML?

Reply
Thread Tools

XSL stylesheet for export of outline from OOImpressu to HTML?

 
 
Matej Cepl
Guest
Posts: n/a
 
      12-04-2004
Hello,

does anybody have %subj%? I would like to generate some very simple HTML
(XHTML?) file from OOImpress, so that I can send it to the friend for
review and not bother her with all images, layouts, and the other junk
(moreover, she probably never heard about OO.o). Powerpoint of the cursed
memory used to have export of outline to RTF. Is there something similar
for OOImpress (certainly, I do not care about RTF, OOWriter or HTML would
be more than enough).

I tried the template from
http://www.xml.com/pub/a/2004/02/04/tr-xml.html, but even though I tried to
install it into OOImpress (with Tools/XML Filter Settings), but the result
is highly unnice (see original at
http://www.ceplovi.cz/matej/tmp/gene...-testimony.sxi and the
result is
http://www.ceplovi.cz/matej/tmp/gene...ony.xhtml.bz2).

Any thoughts?

Thanks for any reply,

Matėj

--
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488

Q: Is vi an easy editor to learn, is it intuitive?
A: Yes, some of us think so. But most people think that we are
crazy.
-- vi FAQ
 
Reply With Quote
 
 
 
 
Joris Gillis
Guest
Posts: n/a
 
      12-04-2004
Hi,

> does anybody have %subj%? I would like to generate some very simple HTML
> (XHTML?) file from OOImpress, so that I can send it to the friend for
> review and not bother her with all images, layouts, and the other junk

Well, in the first place, you could consider not to make presentations full of junk

> (moreover, she probably never heard about OO.o).

Then let her know it exists

> Powerpoint of the cursed
> memory used to have export of outline to RTF. Is there something similar
> for OOImpress (certainly, I do not care about RTF, OOWriter or HTML would
> be more than enough).


OOImpress has export filters to PDF, flash and html. You can probably use one of them.
File->Export...

> I tried the template from
> http://www.xml.com/pub/a/2004/02/04/tr-xml.html, but even though I tried to
> install it into OOImpress (with Tools/XML Filter Settings), but the result
> is highly unnice (see original at
> http://www.ceplovi.cz/matej/tmp/gene...-testimony.sxi and the
> result is
> http://www.ceplovi.cz/matej/tmp/gene...ony.xhtml.bz2).


If that stylesheet doesn't satisfy you, why not improve it yourself? http://books.evc-cit.info/book.php is a good place to learn the file format of OpenOffice.

regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
 
Reply With Quote
 
 
 
 
Matej Cepl
Guest
Posts: n/a
 
      12-05-2004
Joris Gillis wrote:
> Well, in the first place, you could consider not to make presentations
> full of junk


I meant pictures and such stuff.

>> (moreover, she probably never heard about OO.o).

> OOImpress has export filters to PDF, flash and html. You can probably use
> one of them. File->Export...


Unfortunately, the export to HTML is of no use for me -- it exports every
slide into one page with all images attached as graphics files. What would
I need is just text in form of outline on one page.

> If that stylesheet doesn't satisfy you, why not improve it yourself?
> http://books.evc-cit.info/book.php is a good place to learn the file
> format of OpenOffice.


That's helpful. Thanks!

Matej

--
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488

As with the Christian religion, the worst advertisement for
Socialism is its adherents.
-- George Orwell
 
Reply With Quote
 
Matej Cepl
Guest
Posts: n/a
 
      12-05-2004
Joris Gillis wrote:
> If that stylesheet doesn't satisfy you, why not improve it yourself?
> http://books.evc-cit.info/book.php is a good place to learn the file
> format of OpenOffice.


I tried to develop my own style, but there are some things in XPath, which I
do not know how to express. If I understand correctly then the unordered
list in OOImpress is like this:

<text:unordered-list text:style-name="L2">
<text:list-item>
<text:unordered-list>
<text:list-item>
<text text:style-name="P3">Presentation for Living Waters</text>
</text:list-item>
</text:unordered-list>
</text:list-item>
</text:unordered-list>
<text:unordered-list text:style-name="L2">
<text:list-item>
<text:unordered-list>
<text:list-item>
<text text:style-name="P3">Monday, December 5th</text>
</text:list-item>
</text:unordered-list>
</text:list-item>
</text:unordered-list>

The problem is that I would need to condens all elements
<text:unordered-list text:style-name="L2"> into one <ul> element. Do you
have idea how to do it with XSLT, please?

Thanks a lot,

Matej

--
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488

Scouts are saving aluminum cans, bottles and other items to be
recycled. Proceeds will be used to cripple children.
-- from a church bulletin

------------------------------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
xmlns:style="http://openoffice.org/2000/style"
xmlns:text="http://openoffice.org/2000/text"
xmlnsffice="http://openoffice.org/2000/office"
xmlns:table="http://openoffice.org/2000/table"
xmlns:draw="http://openoffice.org/2000/drawing"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlnslink="http://www.w3.org/1999/xlink"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:meta="http://openoffice.org/2000/meta"
xmlns:number="http://openoffice.org/2000/datastyle"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:chart="http://openoffice.org/2000/chart"
xmlns:dr3d="http://openoffice.org/2000/dr3d"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:form="http://openoffice.org/2000/form"
xmlns:script="http://openoffice.org/2000/script"
xmlns:config="http://openoffice.org/2001/config"
xmlnssl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlnsresentation="http://openoffice.org/2000/presentation"
office:class="text"
exclude-result-prefixes="office meta table number dc fo xlink chart math
script xsl draw svg dr3d form config text style">

<xslutput indent="yes"
method="xml"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
encoding="utf-8"
/>

<xsl:template match="drawage">
<h1><xsl:number/>.
<xsl:value-of select="draw:text-box[1]/text[1]"/></h1>
<!-- xsl:apply-templates select="presentation:notes"/ -->
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="text">
<p><xsl:apply-templates/></p>
</xsl:template>

<xsl:template match="/">
<html>
<head>
<title>Speaker Notes</title>
<xsl:element name="meta">
<xsl:attribute name="name">DC.date</xsl:attribute>
<xsl:attribute name="content">
<xsl:value-of select="/dc:date"/>
</xsl:attribute>
</xsl:element>
<style>
<xsl:comment>
p {font-size: 10pt}
h1 {font-family: arial; font-size: 12pt; font-weight:
bold}
</xsl:comment>
</style>
</head>
<xsl:apply-templates/>
</html>
</xsl:template>

<xsl:template match="office:body">
<body>
<xsl:apply-templates />
</body>
</xsl:template>

<xsl:template match="text:unordered-list[@text:style-name='L2']">
<ul>
<xsl:apply-templates />
</ul>
</xsl:template>

<xsl:template match="textrdered-list">
<ol>
<xsl:apply-templates />
</ol>
</xsl:template>

<xsl:template match="text:list-item[not(text:unordered-list)]">
<li><xsl:apply-templates /></li>
</xsl:template>

<xsl:template match="text:span[@text:style-name='T1']">
<em><xsl:apply-templates/></em>
</xsl:template>

<!-- sections of the OO format we don't need at present -->
<xsl:template match="office:automatic-styles" />
<xsl:template match="office:font-decls" />
<xsl:template match="office:meta" />
<xsl:template match="office:script" />
<xsl:template match="office:settings" />
<xsl:template match="office:styles" />
<xsl:template match="style:*" />
<xsl:template match="dc:*">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="meta:creation-date">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="meta:editing-cycles" />
<xsl:template match="meta:editing-duration" />
<xsl:template match="meta:generator" />
<xsl:template match="meta:user-defined" />
<!--
<xsl:template match="text()">
<xsl:apply-templates select="normalize-space(.)"/>
</xsl:template>
-->
</xsl:stylesheet>
 
Reply With Quote
 
Morris M. Keesan
Guest
Posts: n/a
 
      12-06-2004
On Sun, 05 Dec 2004 17:03:53 -0500, Matej Cepl <(E-Mail Removed)>
wrote:
> <text:unordered-list text:style-name="L2">
> <text:list-item>
> <text:unordered-list>
> <text:list-item>
> <text text:style-name="P3">Presentation for Living Waters</text>
> </text:list-item>
> </text:unordered-list>
> </text:list-item>
> </text:unordered-list>
> <text:unordered-list text:style-name="L2">
> <text:list-item>
> <text:unordered-list>
> <text:list-item>
> <text text:style-name="P3">Monday, December 5th</text>
> </text:list-item>
> </text:unordered-list>
> </text:list-item>
> </text:unordered-list>
>
>The problem is that I would need to condens all elements
><text:unordered-list text:style-name="L2"> into one <ul> element. Do you
>have idea how to do it with XSLT, please?


In some template:
<ul>
<xsl:apply-templates
select="text:unordered-list[@text:style-name="'L2'"]/>
</ul>

and then
....

<xsl:template match="text:unordered-list">
<xsl:value-of select="."/>
</xsl:template>

Or, alternately:

<ul>
<xsl:for-each select="text:unordered-list[@text:style-name="'L2'"]>
<xsl:value-of select="."/>
</xsl:for-each>
</ul>

--
Morris M. Keesan -- http://www.velocityreviews.com/forums/(E-Mail Removed)

 
Reply With Quote
 
Matej Cepl
Guest
Posts: n/a
 
      12-06-2004
Morris M. Keesan wrote:
>>The problem is that I would need to condens all elements
>><text:unordered-list text:style-name="L2"> into one <ul> element. Do you
>>have idea how to do it with XSLT, please?

>
> In some template:
> <ul>
> <xsl:apply-templates
> select="text:unordered-list[@text:style-name="'L2'"]/>
> </ul>
>
> and then
> ...
>
> <xsl:template match="text:unordered-list">
> <xsl:value-of select="."/>
> </xsl:template>


I tried this one, but it doesn't seem to work. See
http://www.ceplovi.cz/matej/tmp/gene...timony.xml.bz2
(FlatXML from OpenOffice) and
http://www.ceplovi.cz/matej/tmp/ooimpress-to-html.xsl, which produces
http://www.ceplovi.cz/matej/tmp/gene...estimony.xhtml --
certainly not what I hoped for.

Any thoughts?

Matej Cepl

--
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488

In order to avoid being called a flirt, she always yielded
easily.
-- Charles, Count Talleyrand


 
Reply With Quote
 
Joris Gillis
Guest
Posts: n/a
 
      12-06-2004
Hi,

You are extremely close to the solution; try this:
Nice stylesheet of yours, by the way.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
xmlns:style="http://openoffice.org/2000/style"
xmlns:text="http://openoffice.org/2000/text"
xmlnsffice="http://openoffice.org/2000/office"
xmlns:table="http://openoffice.org/2000/table"
xmlns:draw="http://openoffice.org/2000/drawing"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlnslink="http://www.w3.org/1999/xlink"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:meta="http://openoffice.org/2000/meta"
xmlns:number="http://openoffice.org/2000/datastyle"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:chart="http://openoffice.org/2000/chart"
xmlns:dr3d="http://openoffice.org/2000/dr3d"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:form="http://openoffice.org/2000/form"
xmlns:script="http://openoffice.org/2000/script"
xmlns:config="http://openoffice.org/2001/config"
xmlnssl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlnsresentation="http://openoffice.org/2000/presentation"
office:class="text"
exclude-result-prefixes="office meta table number dc fo xlink chart math script xsl draw svg dr3d form config text style">

<xslutput indent="yes"
method="xml"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
encoding="utf-8"
/>

<xsl:template match="/">
<html>
<head>
<title>Speaker Notes</title>
<xsl:element name="meta">
<xsl:attribute name="name">DC.date</xsl:attribute>
<xsl:attribute name="content">
<xsl:value-of select="/dc:date" />
</xsl:attribute>
</xsl:element>
<style>
<xsl:comment>
p {font-size: 10pt}
h1 {font-family: arial; font-size: 12pt; font-weight:
bold}
</xsl:comment>
</style>
</head>
<xsl:apply-templates/>
</html>
</xsl:template>

<xsl:template match="office:body">
<body>
<xsl:apply-templates />
</body>
</xsl:template>

<xsl:template match="drawage">
<h1><xsl:number/>.
<xsl:value-of select="draw:text-box[1]/text[1]"/></h1>

<xsl:apply-templates />

</xsl:template>


<xsl:template match="text">
<p><xsl:apply-templates/></p>
</xsl:template>

<xsl:template match="text:unordered-list">
<ul><xsl:apply-templates /></ul>
</xsl:template>

<xsl:template match="text:list-item">
<li><xsl:apply-templates /></li>
</xsl:template>

<xsl:template match="text:span[@text:style-name='T1']">
<em><xsl:apply-templates/></em>
</xsl:template>

<!-- sections of the OO format we don't need at present -->
<xsl:template match="office:automatic-styles" />
<xsl:template match="office:font-decls" />
<xsl:template match="office:meta" />
<xsl:template match="office:script" />
<xsl:template match="office:settings" />
<xsl:template match="office:styles" />
<xsl:template match="style:*" />
<xsl:template match="dc:*">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="meta:creation-date">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="meta:editing-cycles" />
<xsl:template match="meta:editing-duration" />
<xsl:template match="meta:generator" />
<xsl:template match="meta:user-defined" />

<!-- xsl:template match="text()">
<xsl:apply-templates select="normalize-space(.)"/>
</xsl:template -->

</xsl:stylesheet>

regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
 
Reply With Quote
 
Joris Gillis
Guest
Posts: n/a
 
      12-06-2004
> Joris Gillis wrote:
>> You are extremely close to the solution; try this:
>> Nice stylesheet of yours, by the way.

>
> Thanks a lot, now it works!

I'm glad it works.
> Concerning the stylesheet for export of plain
> Speaker notes from OOImpress, I was working on the top of
> http://www.xml.com/pub/a/2004/02/04/tr-xml.html, and as a former lawyer I
> learned a value of good intendation hard way .
>
> The only problem I have (and it is really unimportant) -- is there a way how
> to clean XML output of all the redundant empty spaces and empty lines?


Yes, just set indent to no:

<xslutput indent="no"
method="xml"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
encoding="utf-8"
/>

and use:
<xsl:template match="drawage">
<h1><xsl:number/><xsl:text>.</xsl:text>
<xsl:value-of select="draw:text-box[1]/text[1]"/></h1>
<xsl:apply-templates />

</xsl:template>
to get optimal whitespace compression.


btw: I you're going to analyze the XML of OOo files. It's handy to uncheck Tools->Options->Load/Save->General->'size optimization' for nice indentation. That's easier to read

regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
 
Reply With Quote
 
Matej Cepl
Guest
Posts: n/a
 
      12-06-2004
Joris Gillis wrote:
> btw: I you're going to analyze the XML of OOo files. It's handy to uncheck
> Tools->Options->Load/Save->General->'size optimization' for nice
> indentation. That's easier to read


Thanks,

Matej

--
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488

The state is the great fictitious entity by which everyone seeks
to live at the expense of everyone else.
-- Frederick Bastiat


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL for converting all rows and columns of XSL for Export to Excel. dynamic looping enggr XML 0 06-30-2010 10:06 PM
Use output of XSL transformation as new XSL stylesheet barney.b@iname.com XML 0 01-16-2006 02:29 PM
[XSL] : use array variable in XSL stylesheet MC XML 1 03-24-2005 10:41 AM
Documenting xsl (searching xsl:doc stylesheet) Thomas Sommer XML 0 11-25-2004 01:03 AM
Stylesheet referanse i stylesheet =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?= XML 3 07-04-2004 03:16 PM



Advertisments