--------------------- Wrapping elements ---------------------
Using XSLT to add structure to the flat XML structure of the OpenOffice
document is certainly only to a limited extent possible.
In fact, I assume I have to use the OpenOffice API to write a filter and create any missing structure.
Framemaker as authoring tool does offer a procedure (using a.k.a. mapping files...) which you can use to add structure to some extent. But I assume OpenOffice has nothing of the kind.
XSLT is probably a better way to keep full control.
--------------------- XSLT problems ---------------------
Yes, I think I have to delve deeper into the XSLT part.
I am using:
java org.apache.xalan.xslt.Process
Perfect, fully conformant.
My problem (Perhaps this might amuse you!):
Don't think so, I spend lots of time on that. Not sure I have the most efficient way, but it works with quite lots of cases
I can use "following-sibling" for a look-ahead. and find out that "the next para will be the start of a para with the style "Preformatted Text" , for example. (Then I can say "start CDATA!")
You get the problem.
This here may give you some ideas
(anchor works with an XSL browser like firefox or IE, transformation on client).
Logic is
<http://transfolio.org/transform/sxw/sxw2html.xsl#28> match all para get style of current para of previous if current style is "pre" and previous not, open a pre section call a template "level 2" to handle first pre if current style is "pre", and previous is also "pre", do nothing (should be handled by level 2)
<http://transfolio.org/transform/sxw/sxw2html.xsl#level2>
level 2
get style of current para
of previous
if current style is "pre", what you want in your pre (hope disable escaping will work like you want)
if next style is pre, call level 2 to do the same thing for the next
Be careful of something, I work in server context, able to apply 2 passes. My style names are normalized here
<http://transfolio.org/transform/sxw/sxw2sxw.xsl#17>
This is critic for me, because real life sxw files have usually "automatic-styles" (really bad idea from OOo dev). Also, i need customizable styles in different languages, and for different exports.
BUT: I cannot predict the results of using XPath axis preceding-sibling - it never seems to return anything useful. So I will never find out, for example, that the "Preformatted Text" I am already in has already started - a Heading (text:h) was the immediately preceding element.
Perhaps I have to find an XML parser that has a fully funkctioning "preceding-sibling" axis (?)
If you want to work seriously XSLT, buy the book of Michael Kay, it's a Bible. You can also find his answers in public lists by google.
Do your surprises on preceding-sibling may come from the fact it returns a "nodeset" ? something like
preceding-sibling::*[1] answer to your question ?
--------------------- CDATA ---------------------
The CDATA requirement is set by the open source project Apache Maven.
I can reject this and remain satisified with the character escaping done by OpenOffice.
Still we might have a requirement later to pass thru CDATA elements and I will be alert to find an XSLT stylesheet processor which is capable of "unescaping" characters for elements which are specified as CDATA.
Yes, <xsl:output cdata-section-elements="my:cdata"/> does work.
But in this case, instead of specify each and every paragraph as a CDATA section, it would have been nice to wrap all paras into a <source> element and then specify the <source> element as CDATA . But I will still consider this approach
You may also find lots of tricks here <http://www.dpawson.co.uk/xsl/>
and wishing you a nice start into the week
If I read that sooner...
-- Fr�d�ric Glorieux ("AJLSM", <http://ajlsm.com>) "Transfolio" <http://transfolio.org>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
