Re: odf2xhtml

Gannon Dick <[email protected]> Fri, 9 Apr 2010 08:20:14 -0700 (PDT)
Newsgroups gmane.comp.openoffice.devel.xml
Message-ID <[email protected]>
Svante, I thought you had us Americans convinced "Vacation" is a default va=
lue :)=0A=0AWhen would you anticipate the switch-over to XSLT 2.0 ?  Does t=
he free Saxon handle that or is the warning just to nag you to upgrade?  Dr=
. Kay might not admire my, um, frugality, as much as I do his work.=0A=0ATh=
e <head> meta data needs quite a bit of work. I do not think that the itemp=
rop mechanism in HTML 5 is going to make the modeling issues (SKOS, OWL) wi=
th Linked Data any clearer.  I am working on an OpenOffice to Linked Data "=
Home Page" scheme for small scale Government Work.  With 5-6 small steps I =
can switch to an XSD Schema and tag the meta data and citations important f=
or linking, yet preserve the layout style which is easy to read.  The idea =
is that if you had a pile of forms (raw data) you could first redact out th=
e private data then make a "Home Page" for the rest of the data, linked wit=
h deri's voiD or something similar. The hardest part is to convince *yourse=
lf* that commercial branding and style tricks behind the scenes are counter=
-productive.  As I am fond of saying, everybody lives near "Berlin", but on=
ly some of those Berlins are in Germany. =0A=0A--Gannon=0A=0A=0A--- On Fri,=
 4/9/10, Svante Schubert - Sun Germany - Software Engineer <Svante.Schubert=
@sun.com> wrote:=0A=0A> From: Svante Schubert - Sun Germany - Software Engi=
neer <[email protected]>=0A> Subject: Re: [xml-dev] odf2xhtml=0A> To:=
 [email protected]=0A> Cc: [email protected]=0A> Date: Friday=
, April 9, 2010, 8:31 AM=0A> Hi guys,=0A> =0A> sorry for the belayed respon=
se. Coincidently I had been=0A> working on the =0A> XHTML filter lately, fi=
xing some image alignment problem=0A> (using CSS =0A> float to get a simila=
r layout as in OOO). When I bring in=0A> this changes =0A> into OOO, we can=
 work together on the filter.=0A> =0A> I like the idea of keeping the inher=
itance via multiple=0A> styles, it will =0A> lower the burden of resolving =
inheritance from ODF to HTML.=0A> Years ago it =0A> did not work in the mai=
n browsers, did you tested it if it=0A> is now =0A> working in the latest c=
ommon browsers?=0A> =0A> Regarding the switch from XSLT 1.0 to XSLT 2.0, we=
 would=0A> drop the =0A> possibility to use XSLT 1.0 processors.=0A> For in=
stance, I once wrote a prototype of a Firefox viewer=0A> using the on =0A> =
board Mozilla XSLT processor.=0A> What are the advantages of XSLT 2.0?=0A> =
=0A> Note: When we upgrade Saxon - what I thinking over to do as=0A> there =
are =0A> some bugs lately fixed, that causes problem in some filter=0A> - t=
here will =0A> no longer Java method access being supported by the free=0A>=
 Saxon Home edition.=0A> As this Java method Access is a none standardized =
feature I=0A> am willing =0A> to switch to the latest version and dropping =
this=0A> undocumented feature.=0A> =0A> Going to be next week on vacation, =
soon after that I plan=0A> to start a CWS =0A> where we can work together o=
n the HTML filter.=0A> Martynas could you write please write an issue, that=
 we=0A> might use in the =0A> CWS? Otherwise the QA might oversee your patc=
h.=0A> =0A> Thanks in advance,=0A> Svante=0A> =0A> =0A> On 03/21/10 16:56, =
Martynas Jusevicius wrote:=0A> > I forgot I'm running it on XSLT 2.0 proces=
sor...=0A> > <xsl:apply-templates select=3D"$parentStyle"> will=0A> probabl=
y not work in=0A> > XSLT 1.0, but you get the general idea.=0A> > =0A> > On=
 Sun, Mar 21, 2010 at 4:29 PM, Martynas Jusevicius=0A> > <martynas.jusevici=
[email protected]>=0A> wrote:=0A> >> Here's a partial fix for this issue, I don'=
t know=0A> if I should try=0A> >> submitting it somewhere.=0A> >>=0A> >> It=
 requires modification of=0A> /export/xhtml/body.xhtml stylesheet:=0A> >> h=
ttp://framework.openoffice.org/source/browse/*checkout*/framework/filter/so=
urce/xslt/odf2xhtml/export/xhtml/body.xsl?content-type=3Dtext%2Fplain&rev=
=3D1.3.16.3=0A> >>=0A> >> @text:style-name template needs to be modified an=
d=0A> one recursive=0A> >> template (inherited-classes) needs to be added:=
=0A> >>=0A> >> <xsl:template match=3D"style:style"=0A> mode=3D"inherited-cl=
asses">=0A> >>=A0 =A0 <xsl:param name=3D"globalData"/>=0A> >>=A0 =A0 <xsl:v=
ariable name=3D"styleFamily"=0A> select=3D"@style:family" />=0A> >>=A0 =A0 =
<xsl:variable=0A> name=3D"parentStyleName" select=3D"@style:parent-style-na=
me"=0A> />=0A> >>=A0 =A0 <xsl:variable name=3D"parentStyle"=0A> >>=0A> sele=
ct=3D"$globalData/office:styles/style:style[@style:family=0A> =3D=0A> >> $s=
tyleFamily and @style:name =3D=0A> $parentStyleName]"/>=0A> >>=0A> >>=A0 =
=A0 <xsl:value-of=0A> select=3D"translate(@style:name, '.,;: %()[]/\+',=0A>=
 >> '_____________')"/>=0A> >>=A0 =A0 <xsl:text> </xsl:text>=0A> >>=A0 =A0 =
<xsl:apply-templates=0A> select=3D"$parentStyle" mode=3D"inherited-classes"=
>=0A> >>=A0 =A0 =A0 =A0 <xsl:with-param=0A> name=3D"globalData" select=3D"$=
globalData"/>=0A> >>=A0 =A0 </xsl:apply-templates>=0A> >> </xsl:template>=
=0A> >>=0A> >> <xsl:template match=3D"@text:style-name |=0A> @draw:style-na=
me |=0A> >> @draw:text-style-name |=0A> @table:style-name"><!-- |=0A> >> @p=
resentation:style-name-->=0A> >>=A0 =A0 =A0 =A0 <xsl:param=0A> name=3D"glob=
alData"/>=0A> >>=A0 =A0 =A0 =A0 <xsl:variable=0A> name=3D"style"=0A> >>=0A>=
 select=3D"$globalData/office:automatic-styles/style:style[@style:name=0A> =
=3D=0A> >> current()]"/>=0A> >>=A0 =A0 =A0 =A0 <xsl:variable=0A> name=3D"st=
yleFamily" select=3D"$style/@style:family" />=0A> >>=A0 =A0 =A0 =A0 <xsl:va=
riable=0A> name=3D"parentStyleName"=0A> >> select=3D"$style/@style:parent-s=
tyle-name" />=0A> >>=A0 =A0 =A0 =A0 <xsl:variable=0A> name=3D"parentStyle"=
=0A> >>=0A> select=3D"$globalData/office:styles/style:style[@style:family=
=0A> =3D=0A> >> $styleFamily and @style:name =3D=0A> $parentStyleName]"/>=
=0A> >>=0A> >>=A0 =A0 =A0 =A0 <xsl:attribute=0A> name=3D"class">=0A> >>=A0 =
=A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 <xsl:value-of select=3D"translate(., '.,;:=
=0A> %()[]/\+',=0A> >> '_____________')"/>=0A> >>=A0 =A0 =A0 =A0 =A0 =A0 =
=A0=0A> =A0 <xsl:text> </xsl:text>=0A> >>=A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =
=A0 <xsl:apply-templates select=3D"$parentStyle"=0A> >> mode=3D"inherited-c=
lasses">=0A> >>=A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 =A0 <xsl:with-param =
name=3D"globalData"=0A> select=3D"$globalData"/>=0A> >>=A0 =A0 =A0 =A0 =A0 =
=A0 =A0=0A> =A0 </xsl:apply-templates>=0A> >>=A0 =A0 =A0 =A0 </xsl:attribut=
e>=0A> >> </xsl:template>=0A> >>=0A> >> There is also at least one other pl=
ace in body.xsl=0A> (in the text:h=0A> >> template) where @text:style-name =
template needs to=0A> be called (with the=0A> >> $globalData param) for the=
 fix to have effect=0A> instead of simply=0A> >> outputting style name to t=
he @class attribute.=0A> >>=0A> >> The full fix would be to prevent excessi=
ve=0A> (overlapping in parent and=0A> >> children) CSS properties from bein=
 generated.=0A> >>=0A> >> Martynas=0A> >> odt2epub.com=0A> >>=0A> >> On Fri=
, Mar 19, 2010 at 5:55 PM, Vyacheslav Sedov=0A> >> <vyacheslav.sedov@gmail.=
com>=0A> wrote:=0A> >>> good idea - i can help with XSLT 2.0 - our=0A> proj=
ect have some odf2xhtml=0A> >>> code - our code is XSLT 2.0 - not XSLT 1.0=
=0A> from OpenOffice=0A> >>>=0A> >>> with best wishes,=0A> >>> Slav=0A> >>>=
=0A> >>> 2010/3/19 Martynas Jusevicius <[email protected]>:=0A>=
 >>>> Hey list,=0A> >>>>=0A> >>>> I've been working with odf2xhtml XSLT=0A>=
 filter a lot lately, in relation=0A> >>>> to ePub e-books. It does its job=
 but it's=0A> really showing its age. I=0A> >>>> wonder if there are plans =
for a new=0A> version? It could really benefit=0A> >>>> from many of XSLT 2=
 features.=0A> >>>>=0A> >>>> One of the most annoying things is the=0A> gen=
erated CSS. If style A=0A> >>>> defines bold text and style B is inherited=
=0A> from A and additionally=0A> >>>> defines right alignment, odf2xhtml=0A=
> generates such code:=0A> >>>>=0A> >>>> .A { font-weight: bold; }=0A> >>>>=
 .B { font-weight: bold; text-align: right;=0A> }=0A> >>>>=0A> >>>> <p clas=
s=3D"A"> ... <p=0A> class=3D"B">=0A> >>>>=0A> >>>> That shows up OK in the =
browser, but=0A> removes the relationship between=0A> >>>> A and B in the X=
HTML/CSS output. For=0A> example, if I need to select all=0A> >>>> elements=
 with style inherited from A, I=0A> cannot do that without looking=0A> >>>>=
 into the original ODT and examining the=0A> styles.=0A> >>>>=0A> >>>> I th=
ink much better output could be=0A> achieved using multiple classes in XHTM=
L:=0A> >>>>=0A> >>>> .A { font-weight: bold; }=0A> >>>> .B { text-align: ri=
ght; }=0A> >>>>=0A> >>>> <p class=3D"A"> ... <p class=3D"A=0A> B">=0A> >>>>=
=0A> >>>> What do you think?=0A> >>>>=0A> >>>> Martynas=0A> >>>> odt2epub.c=
om=0A> >>>>=0A> >>>>=0A> --------------------------------------------------=
-------------------=0A> >>>> To unsubscribe, e-mail: [email protected]=
enoffice.org=0A> >>>> For additional commands, e-mail: [email protected]=
ice.org=0A> >>>>=0A> >>>>=0A> >>>=0A> -------------------------------------=
--------------------------------=0A> >>> To unsubscribe, e-mail: dev-unsubs=
[email protected]=0A> >>> For additional commands, e-mail: dev-help@=
xml.openoffice.org=0A> >>>=0A> >>>=0A> > =0A> >=0A> -----------------------=
----------------------------------------------=0A> > To unsubscribe, e-mail=
: [email protected]=0A> > For additional commands, e-mail:=
 [email protected]=0A> > =0A> > =0A> > =0A> =0A> ----------------=
-----------------------------------------------------=0A> To unsubscribe, e=
-mail: [email protected]=0A> For additional commands, e-ma=
il: [email protected]=0A> =0A> =0A=0A=0A