Issue 22012 - XHTML doesn't export embedded graphics / images
Summary: XHTML doesn't export embedded graphics / images
Status: CLOSED FIXED
Alias: None
Product: xml
Classification: Code
Component: external filters (show other issues)
Version: OOo 1.1
Hardware: All All
: P3 Trivial with 9 votes (vote)
Target Milestone: OOo 3.0
Assignee: jogi
QA Contact: issues@xml
URL:
Keywords: oooqa
: 50855 67759 72924 (view as issue list)
Depends on: 24398
Blocks:
  Show dependency tree
 
Reported: 2003-11-02 04:44 UTC by vardaru
Modified: 2008-09-09 13:13 UTC (History)
8 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Writer->XHTML exported file with an image included (1.43 KB, text/plain)
2003-11-03 07:09 UTC, jogi
no flags Details
an example doc (120.64 KB, application/octet-stream)
2003-11-03 14:18 UTC, vardaru
no flags Details
document with images (892.15 KB, application/vnd.oasis.opendocument.text)
2008-04-21 16:59 UTC, xquery
no flags Details
resulted html with embedded images (1.11 MB, text/html)
2008-04-21 17:01 UTC, xquery
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description vardaru 2003-11-02 04:44:27 UTC
xthml export of writer docs doesn't export graphics, img etc, inside the 
document. It yields something like <img width="59" height="81" src="" 
class="fr2">.
Comment 1 con.hennessy 2003-11-02 22:30:41 UTC
Confirmed on OOo 1.1.0 on linux 
Comment 2 jogi 2003-11-03 07:06:25 UTC
Reporter: I have exported a XHTML file with an imnage inside. I just
used Insert -> Graphics -> From File and File -> Export -> selected
XHTML and it worked fine. How do you inserted the image?
A clear description in future would be fine (and I don't know how
'cphennesy' could confirm it because I have used also Linux.
Comment 3 jogi 2003-11-03 07:09:04 UTC
Created attachment 10898 [details]
Writer->XHTML exported file with an image included
Comment 4 vardaru 2003-11-03 07:45:35 UTC
1. I followed what Joerg said but didnot worked. My machine is 
Win/XP professional. I got the same thing. 
2. The images were included in the document because I am trying to 
convert my old word for mac documents. OOo writer reads all the 
documents and saves them in sxw format. (Thou there are some image 
placement problems, it works _well_.) BTW when I look at the 
content.xml I see that those images are in pct and object (ole) 
format. 

I can send an example doc if needed.
Comment 5 jogi 2003-11-03 07:57:11 UTC
Reporter: Yes, please do it. Everytime you file a bug where a document
is affected you should send the source and the result as an
attachment. It is much more easier to resolve such issues.
Comment 6 jogi 2003-11-03 08:01:08 UTC
Reporter: Ahhh, I read "content.xml" in your sentence. You mean not
XHTML you mean trasnformation from mac:Word documents ->
OpenOffice.org|StarOffice (.sxw) file format makes trouble, am I
right? If so, we need the documents but you are in the wrong
component. I will put it then in the correct one and will change also
the title.
Comment 7 vardaru 2003-11-03 14:18:23 UTC
Created attachment 10910 [details]
an example doc
Comment 8 vardaru 2003-11-03 14:26:17 UTC
mac:word -> OpenOffice (.sxw) conversion works _well_. As you can 
see there is some layout problems but they are not important at the 
moment.

The problem is that when I try to export the document to xhtml the 
resultant document contains img tags like <img width="59" 
height="81" src="" class="fr2"> for the images.
Comment 9 jogi 2003-11-03 14:40:01 UTC
Reporter: It is very easy: The EMBEDDED images are not exported by the
external filter (XSLT stylesheet). Linked images are no problem. XHTML
is a SAMPLE for the XSLT |external XML filter technology OOo 1.1.0
supports since that version. Thank you for reporting that issue!
Comment 10 jogi 2003-11-03 14:41:04 UTC
Not invalid. It is an issue in the XSLT stylesheet AFAIK.
Comment 11 jogi 2003-11-03 14:42:06 UTC
cc: Swante.
Comment 12 lo 2003-11-03 15:45:23 UTC
changed owner for piece of cake - thanks ;)
Comment 13 lo 2003-11-03 16:37:24 UTC
change owner, retry
Comment 14 svante.schubert 2003-11-03 18:43:33 UTC
Thank you for reporting the bug. 

I will fix it and provide a downloadable on OOo, the latter might cost
some time, but I anounce it in the bug, when managed.

A mailing list might be of interest, to get a notify of the latest
updates.


Comment 15 svante.schubert 2003-11-03 19:02:11 UTC
Two tips for a better transforming of the orginal test document:

1.) The embedded pictures should be better of type PNG (or JPEG, GIF)
than SVM and PCT. Otherwise the browsers gonna have problems to show
them. (A different approach would be to express the math formulas by
the office, but once you created the pictures already, it might be
easier to transform the pictures).


2.) If you want to have a XHTML output close to the layout of your
original office document, you might use a table in the office document
to express the two columns. 
Otherwise you have to tweak the transformation to create these two
columns. ;)
Comment 16 vardaru 2003-11-03 20:12:36 UTC
1. Exported images should be of type that browsers can handle.
2. I have no problem with the resultant layout. Once I get the  
xhtml document I can play with it:-D 

Note also that some of the graphics objects are OLE objects.   
Comment 17 svante.schubert 2003-11-03 20:21:24 UTC
> 1. Exported images should be of type that browsers can handle.

You are right, but XSLT itself does not provide this functionality,
the automatic conversion would be a feature request itself, I will
discuss it with the developer of the application side. But having our
current feature list in mind, I see little change that this will be
implemented soon, so you better convert the graphics by yourself ;)

> Note also that some of the graphics objects are OLE objects.   

aye, yes thanks for the warning ;)
Comment 18 svante.schubert 2003-11-06 14:50:59 UTC
- (fixed) Embedded images working again
- (fixed) ContentTable URL of Master document remains relative URL
(feature only available with JAVA helper classes, currently not part
of office filter)
- (new feature) Added default implementation of <draw:object-ole>
element, which represents objects that only have a binary
representation. By default they will be handled like an <draw:image>
element.

This bug is not in a CWS (child work space) yet and the documentation
on http://xml.openoffice.org/sx2ml/ has not been updated, either.
Comment 19 jogi 2003-11-26 06:37:43 UTC
Swante/Lars: Just a question. Does it make sense to fix that issue in
a OOo 1.1.2? It's just the stylesheet AFAIK. It could demonstrate
better the benefit of using XSLT for converting documents...
Comment 20 svante.schubert 2003-11-26 17:00:55 UTC
You are totally right, as it is already fixed, this issue is only
waiting for some others to join together in a CWS into the next version.
As soon I am ready, we gonna have a chat about quality assurance ;)
Comment 21 svante.schubert 2004-01-27 13:20:33 UTC
Unfortunately the transformations need to get parameters from the filter
environements to be able to show the embedded graphics. In this case a JAR URL
is to the zipped document is necessary, as the graphics won't be unpacked by XSLT.

Added dependency to the parameter enhancement i24398

Furthermore, in a patch only changes on the exisiting documents will be
commited. In our case the whole filter (stylesheets) have been refactored and
overworked, so I changed target to OOo2.0.
Comment 22 svante.schubert 2004-07-05 17:42:14 UTC
As this issue is also addressable for embedded pictures of any arbitrary
document format, which can be imported into the office. LO and I decided to save
the images into a directory quite similar named to the output file name aside of
the output (similar to browsers).

AFAIK LO won't be able to fixed this before OpenOffice 2.0
Comment 23 svante.schubert 2004-07-05 17:47:47 UTC
Lars this is of minor impact and you are able fix for the upcoming release, it
would be great! 

When you are ready, please give me feed back about the parameter providing the
image path (e.g. imageBaseURL) you going to provide for the stylesheets.
Comment 24 jogi 2005-06-20 10:15:17 UTC
*** Issue 50855 has been marked as a duplicate of this issue. ***
Comment 25 jr 2005-12-03 19:07:57 UTC
Hi all, can someone please tell me the actual status of this issue?
added jrahemipour to cc
Comment 26 svante.schubert 2005-12-04 21:59:30 UTC
The XHTML export filter as sample filter has currently a quite low priority.
Sorry, there is no ongoing work for this issue. With very little change it might
be done for OOo3.0.

SUS->LO: AFAIK I have inherit these framework issues know, assigned to me.
Comment 27 jogi 2006-07-27 07:23:42 UTC
*** Issue 67759 has been marked as a duplicate of this issue. ***
Comment 28 jogi 2006-07-27 07:30:16 UTC
changed title to find it better in queries.
Comment 29 Rainer Bielefeld 2006-07-27 08:35:51 UTC
I believe this is a more general problem. "Save as HTML" has some very
comfortable functions to handle embedded pictures _and_embedded_OLE_objects_, so
from spreadsheets and charts gif images will be crated during HTML export; these
images will be shown in the exported HTML document. 

IMHO it would be fine to have something similar for XHTML export.
Comment 30 jogi 2007-01-16 07:06:47 UTC
*** Issue 72924 has been marked as a duplicate of this issue. ***
Comment 31 net_buoy 2008-02-19 04:02:09 UTC
This issue effects more than graphics;  it seems to prevent the export of
virtually everything but text. I was surprised that the issue has been around as
long as it has (5 years) while arguably being so basic to the operation of the
product in an open environment (stylesheet wise).  Specifically,  the use of OOo
for Mathematics or any area where equations are needed becomes problematic
because OOo only default exports such equations as images. I am not clear on
whether OOo stores equations in text format or as xml,  but in either case one
would think it would be critical for an export to xhtml to include the MathML. I
did notice that an export to docBook xml format places the equation text in
paran tags.....
Comment 32 xquery 2008-04-21 15:51:45 UTC
i can try pack images into src="data:image/*;binary64,{base64-encoded-image}"

Comment 33 xquery 2008-04-21 16:57:12 UTC
just added this lines

			<xsl:when test="self::draw:image[office:binary-data]">
				<xsl:text>data:image/*;base64,</xsl:text><xsl:value-of
select="office:binary-data"/>
			</xsl:when>

into named template "create-href" in export/common/body.xsl - look like it work
just fine (see odt&html attachment)

here modified template
 
	<xsl:template name="create-href">
		<xsl:param name="href"/>

		<xsl:choose>
			<!-- internal OOo URL used in content tables -->
			<xsl:when test="contains($href, '%7Coutline')">
				<!-- the simple workaround for content tables in a single document is to
create create an anchor from every heading element
					 work-around downside: Multiple identical headings won't refer always to
the first.
				-->
				<xsl:text>#</xsl:text>
				<xsl:variable name="title">
					<xsl:apply-templates mode="concatenate"/>
				</xsl:variable>

				<xsl:value-of select="translate($title, '.,;: %()[]/\+', '_____________')"/>
			</xsl:when>
			<xsl:when test="self::draw:image[office:binary-data]">
				<xsl:text>data:image/*;base64,</xsl:text><xsl:value-of
select="office:binary-data"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:choose>
					 <!-- in case of packed open office document -->
					<xsl:when test="starts-with($sourceBaseURL, 'jar:') or $isPackageFormat">
						<xsl:choose>
							 <!-- for images relative to open office document -->
							<xsl:when test="starts-with($href, '../')">
								<!-- creating an absolute http URL to the packed image file (removing
the '.')-->
								<xsl:value-of
select="concat(substring-after(substring-before($sourceBaseURL, '!'), 'jar:'),
'/', $href, $optionalURLSuffix)"/>
							</xsl:when>
							 <!-- for absolute URLs & absolute paths -->
							<xsl:when test="contains($href, ':') or starts-with($href, '/')">
								<xsl:value-of select="concat($href, $optionalURLSuffix)"/>
							</xsl:when>
							<!-- for images jared in open office document -->
							<xsl:otherwise>
								<xsl:value-of select="concat($sourceBaseURL, $href, $optionalURLSuffix)"/>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:otherwise>
						<xsl:choose>
							 <!-- for absolute URLs & Paths -->
							<xsl:when test="contains($href, ':') or starts-with($href, '/')">
								<xsl:value-of select="concat($href, $optionalURLSuffix)"/>
							</xsl:when>
							 <!-- for relative URLs -->
							<xsl:otherwise>
								<xsl:value-of select="concat($sourceBaseURL, $href, $optionalURLSuffix)"/>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:otherwise>
		</xsl:choose>

	</xsl:template>
Comment 34 xquery 2008-04-21 16:59:43 UTC
Created attachment 53092 [details]
document with images
Comment 35 xquery 2008-04-21 17:01:03 UTC
Created attachment 53093 [details]
resulted html with embedded images
Comment 36 jogi 2008-05-10 07:50:27 UTC
JSI -> SUS: What about the idea to use byte64 code to embed images? Is that a possible solution?
CHG: target. The need is there to decide what to do.
Comment 37 jogi 2008-05-10 07:52:11 UTC
JSI->SUS: base64, not bye :-)
Comment 38 svante.schubert 2008-05-21 22:27:34 UTC
Thanks for the patch with this the encoded BASE64 pictures finally are used.
Just tested on my Macbook with Mozilla 2, will check on other browsers before I
adapt the patch. Any feedback is welcome.

AFAIK there will be only critical fixes for the 3.0 for CWS, but I will adapt it
to the 3.0.1 (bugfix release).

I will creat a CWS 'xsltfilter10' as soon it is possible to do so for 3.0.1.
In this CWS further XHTML issues can be bundled.

BTW since DEV300 m13 there is now an real ODF to XHTML xslt filter in the
Office, which can even be overwritten by an OOo extension being a XSLT filter.
The fixes will than be easily testable in a OOo 3.0.

Bests,
Svante
Comment 39 svante.schubert 2008-05-26 16:19:00 UTC
I see a change to adapt this patch and will take it.
Back to target 3.0 added to CWS.

Thanks for the patch!

Bests,
Svante
Comment 40 svante.schubert 2008-05-26 16:42:27 UTC
Fixed, patch applied in CWS XSLTFILTER10
Comment 41 svante.schubert 2008-07-15 12:32:51 UTC
SUS to JSI:

Just export the image file of the attachment. Images shall remain in XHTML.
Comment 42 svante.schubert 2008-07-15 12:34:18 UTC
moved to QA..
Comment 43 jogi 2008-07-21 12:55:31 UTC
Yeah http://validator.w3.org says that it is "This Page Is Valid XHTML 1.1 plus
MathML 2.0!"
Comment 44 sgautier.ooo 2008-09-09 13:13:29 UTC
Verified in OOO300m5 - Closing - Sophie