|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
ODT - Specifying images to be zipped?Hi All,
Some of you may have noticed I'm working on the Ooo output plugin. I'm at a stage now where I need to specify all images used in an xdoc and create entries for them as a zip:entry . In OOo, the .odt document stores its images in a directory called Pictures. Its easy to do this manually for a known image name and location. e.g - <zip:entry name="Pictures/icon.png" src="cocoon://images/icon.png"></zip:entry> or <zip:entry name="Pictures/cocoon-project-logo.png" src="http://cocoon.apache.org/images/cocoon-project-logo.png"> </zip:entry> both of the above will successfully store the image correctly. However they are hard-coded and of course those images may not even be used by the .odt file in question. Another thing to consider is that a zip:entry is contained in a zip:archive block. <zip:archive> <zip:entry name="blah" ...></zip:entry> </zip:archive> So I need a way to automatically create zip:entry blocks for images referenced within the file. The file may or may not be local, and as far as I can tell, we don't need to physically copy them anywhere, just reference their current locations as a zip entry. I tried also using wildcards, but it seems the ziparchiveserializer [1] doesn't support it. If anyone has any ideas, please shout up :) , it is something I am currently working on so I will continue to look for a solution also. Thanks Gav... [1] - http://cocoon.apache.org/2.1/userdocs/ziparchive-serializer.html |
|
|
Re: ODT - Specifying images to be zipped?Gavin wrote:
> <zip:archive> > <zip:entry name="blah" ...></zip:entry> > </zip:archive> > > So I need a way to automatically create zip:entry blocks for images > referenced within the file. The file may or may not be local, and as far as > I can tell, we don't need to physically copy them anywhere, just reference > their current locations as a zip entry. Something like... <xsl:template match="/"> <!-- create other archive entries --> <xsl:call-template name="createImageEntries"/> <!-- more processing --> </xsl:template> <xsl:template name="createImageEntries"> <xsl:for-each select="./image"> <zip:entry> <xsl:attribute name="name">Pictures/<xsl:value-of select="@src"/></xsl:attribute> <!-- need to extract the relevant part of the URI here --> <xsl:attribute name="src">Pictures/<xsl:value-of select="@src"/></xsl:attribute> <!-- will probably need to make the path absolute, cocoon://... --> </zip:entry> </xsl:for-each> </xsl:template> Ross |
|
|
RE: ODT - Specifying images to be zipped?> -----Original Message----- > From: Ross Gardler [mailto:rgardler@...] > Sent: Monday, 25 August 2008 8:33 PM > To: dev@... > Subject: Re: ODT - Specifying images to be zipped? > > Gavin wrote: > > <zip:archive> > > <zip:entry name="blah" ...></zip:entry> > > </zip:archive> > > > > So I need a way to automatically create zip:entry blocks for images > > referenced within the file. The file may or may not be local, and as far > as > > I can tell, we don't need to physically copy them anywhere, just > reference > > their current locations as a zip entry. > > Something like... > > <xsl:template match="/"> > <!-- create other archive entries --> > <xsl:call-template name="createImageEntries"/> > <!-- more processing --> > </xsl:template> > > <xsl:template name="createImageEntries"> > <xsl:for-each select="./image"> > <zip:entry> > <xsl:attribute name="name">Pictures/<xsl:value-of > select="@src"/></xsl:attribute> <!-- need to extract the relevant part > of the URI here --> > <xsl:attribute name="src">Pictures/<xsl:value-of > select="@src"/></xsl:attribute> <!-- will probably need to make the path > absolute, cocoon://... --> > </zip:entry> > </xsl:for-each> > </xsl:template> Thanks, that does look promising, will let you know how it goes. Gav... > > Ross > > > -- > Internal Virus Database is out-of-date. > Checked by AVG. > Version: 7.5.524 / Virus Database: 270.6.4 - Release Date: 8/16/2008 12:00 > AM |
| Free Forum Powered by Nabble | Forum Help |