You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lincoln Mitchell <li...@interfaces-n-creatives.com> on 2007/08/13 15:38:16 UTC
MathType 2 jpg
I am trying to use "Microsoft Equation" or MathType to create an Equation
in word2003/Wordml and serialise the result as JPEG or GIF.
However, the <w:binData references a ".wmz" and I don't know how to process
this. Ie:
<w:binData w:name="wordml://08000001.wmz">
There is also a .mso reference on an earlier binDdata:
<w:binData w:name="oledata.mso">
There was an earlier thread on this in 2004 from Stavros Kounis .
Subject: ms word xml and embedded images
But didn't seem to propose a solution - unless I missed something.
Any clues appreciated
Linc
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: MathType 2 jpg
Posted by Lincoln Mitchell <li...@interfaces-n-creatives.com>.
Thanks a million for this - I can kind of see what's going on.
I will have to play some more. It would certainly help if I could get the
complete source for the site.
Thanks again!
Linc
> -----Original Message-----
> From: Stavros Kounis [mailto:skounis@gmail.com]
> Sent: Tuesday, 14 August 2007 6:27 PM
> To: users@cocoon.apache.org
> Subject: Re: MathType 2 jpg
>
> Hi Linc
>
> i was misunderstood. the process i was describe was just a
> demonstration of how to get and see the base64 content of wordML
> <w:binData>
>
> i was never render metafiles included in WML just images (jpg).
>
> sitemap snippets:
>
> <map:transformer logger="sitemap.transformer.extractor"
> name="wml-image-extractor"
> src="org.apache.cocoon.transformation.FragmentExtractorTransformer">
>
> <extract-
> uri>http://schemas.microsoft.com/office/word/2003/wordml</extract-uri>
> <extract-element>pict</extract-element>
> </map:transformer>
>
> ...
> ...
>
> <!--
> get a wml source and
> transform it to .xml content with link to images
> images has previously extracted and temporary saved
> thanx to .FragmentExtractorTransformer
> -->
> <map:match pattern="xml/**.wml_src">
> <map:generate src="c_{../locale}/{1}.xml"/>
> <map:transform type="wml-image-extractor"/>
> <map:transform src="osml/plugins/wml-image.xsl"/>
> <map:transform src="osml/plugins/wml-include.xsl"/>
> <map:transform src="osml/plugins/wml-table.xsl"/>
> <map:transform src="osml/plugins/wml-para.xsl"/>
> <map:serialize type="xml"/>
> </map:match>
>
> ...
> ...
>
> <!--
> after wml-image-extractor transformation document contains references
> to "extracted-*.jpg"
> automaticaly generated fro transformer.
>
> this match convert those content upon request
> to jpg. i have test it only with .jpgs
> -->
> <map:match pattern="extracted-*.jpg">
> <map:generate src="{1}" type="extractor"/>
> <map:transform src="osml/plugins/svg.xsl">
> <map:parameter name="image" value="{1}"/>
> </map:transform>
> <map:serialize type="svg2jpeg"/>
> </map:match>
>
> wml-image.xsl:
>
> <?xml version="1.0" encoding="ISO-8859-7"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:fo="http://www.w3.org/1999/XSL/Format"
> xmlns:v="urn:schemas-microsoft-com:vml"
> xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
> xmlns:fe="http://apache.org/cocoon/fragmentextractor/2.0">
> <xsl:template match="/">
> <xsl:apply-templates select="//w:body"/>
> </xsl:template>
>
> <xsl:template match="fe:fragment">
> <img>
> <xsl:attribute name="src">extracted-<xsl:value-of
> select="@fragment-id"></xsl:value-of>.jpg</xsl:attribute>
> </img>
> </xsl:template>
> <xsl:template match="node()|@*" priority="-1">
> <xsl:copy>
> <xsl:apply-templates select="@*"/>
> <xsl:apply-templates/>
> </xsl:copy>
> </xsl:template>
>
> </xsl:stylesheet>
>
> svg.xsl
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:fo="http://www.w3.org/1999/XSL/Format"
> xmlns:v="urn:schemas-microsoft-com:vml"
> xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">
> <xsl:template match="/">
> <xsl:variable name="style"
> select="descendant::v:shape/@style"/>
> <xsl:variable name="width"
> select="substring-before(substring-after($style, 'width:'),';')"/>
> <xsl:variable name="height" select="substring-
> after($style,'height:')"/>
> <svg xmlns="http://www.w3.org/2000/svg">
> <xsl:attribute name="width"><xsl:value-of
> select="$width"/></xsl:attribute>
> <xsl:attribute name="height"><xsl:value-of
> select="$height"/></xsl:attribute>
> <title>Embedded Word 2003 Image</title>
> <g>
> <image
xmlns:xlink="http://www.w3.org/1999/xlink">
> <xsl:attribute
name="width"><xsl:value-of
> select="$width"/></xsl:attribute>
> <xsl:attribute
name="height"><xsl:value-of
> select="$height"/></xsl:attribute>
> <xsl:attribute
> name="xlink:href">data:image/wmf;base64,<xsl:value-of
> select="descendant::w:binData/."/></xsl:attribute>
> </image>
> </g>
> </svg>
> </xsl:template>
> </xsl:stylesheet>
>
> rest .xsl just render wml some wml elements the way i want.
>
> The key here is FragmentExtractorTranformer
>
> Hope that this can help you
>
> See it live:
> http://www.nativus.gr/activity_id=multi1.html
>
> Here both content and images are located into a .wml file saved from
> msword and rendered on-demand.
>
> If you loose your way i'm able to give you compete sources from this
> web site. You have to be patient of course to find some time to pack
> it.
>
> /stavros
>
> On 8/14/07, Lincoln Mitchell <li...@interfaces-n-creatives.com> wrote:
> > Thanks for the reply but I can't yet fill in the blanks. You say:
> > > create the binary file, name it as .zip, unzip it and you have a
> > > windows meta file.
> >
> > I assume you can do this all via the sitemap some how?
> > I found that 2.1.10 has a zip Source example. However, the example is
> about
> > getting test.xml from the external zip file...
> > <map:match pattern="zip/test.xml">
> > <map:generate src="zip:test.zip!/test.xml"/>
> > <map:serialize type="xml"/>
> > </map:match>
> > ...and I need to generate from the wordml code:
> > <w:binData w:name="wordml://08000001.wmz...
> >
> > Can this all be done from the site map?
> > If so I imagine I will need to generate from a xml fragment (if that's
> the
> > right term) somehow.
> > Am I on the right track?
> >
> > Thanks very much for the help.
> >
> > Linc
> >
> > > -----Original Message-----
> > > From: Stavros Kounis [mailto:skounis@gmail.com]
> > > Sent: Monday, 13 August 2007 10:39 PM
> > > To: Lincoln Mitchell
> > > Subject: Re: MathType 2 jpg
> > >
> > > Hi lincoln
> > >
> > > <w:binData> section contains a base64 encoded Compressed Windows
> Metafile
> > > (WMZ)
> > >
> > > for example
> > > create the binary file, name it as .zip, unzip it and you have a
> > > windows meta file.
> > >
> > >
> > > /stavros
> > >
> > >
> > >
> > > On 8/13/07, Lincoln Mitchell <li...@interfaces-n-creatives.com>
> wrote:
> > > > I am trying to use "Microsoft Equation" or MathType to create an
> > > Equation
> > > > in word2003/Wordml and serialise the result as JPEG or GIF.
> > > > However, the <w:binData references a ".wmz" and I don't know how to
> > > process
> > > > this. Ie:
> > > > <w:binData w:name="wordml://08000001.wmz">
> > > > There is also a .mso reference on an earlier binDdata:
> > > > <w:binData w:name="oledata.mso">
> > > >
> > > > There was an earlier thread on this in 2004 from Stavros Kounis .
> > > > Subject: ms word xml and embedded images
> > > >
> > > > But didn't seem to propose a solution - unless I missed something.
> > > >
> > > > Any clues appreciated
> > > > Linc
> > > >
> > > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: MathType 2 jpg
Posted by Stavros Kounis <sk...@gmail.com>.
Hi Linc
i was misunderstood. the process i was describe was just a
demonstration of how to get and see the base64 content of wordML
<w:binData>
i was never render metafiles included in WML just images (jpg).
sitemap snippets:
<map:transformer logger="sitemap.transformer.extractor"
name="wml-image-extractor"
src="org.apache.cocoon.transformation.FragmentExtractorTransformer">
<extract-uri>http://schemas.microsoft.com/office/word/2003/wordml</extract-uri>
<extract-element>pict</extract-element>
</map:transformer>
...
...
<!--
get a wml source and
transform it to .xml content with link to images
images has previously extracted and temporary saved
thanx to .FragmentExtractorTransformer
-->
<map:match pattern="xml/**.wml_src">
<map:generate src="c_{../locale}/{1}.xml"/>
<map:transform type="wml-image-extractor"/>
<map:transform src="osml/plugins/wml-image.xsl"/>
<map:transform src="osml/plugins/wml-include.xsl"/>
<map:transform src="osml/plugins/wml-table.xsl"/>
<map:transform src="osml/plugins/wml-para.xsl"/>
<map:serialize type="xml"/>
</map:match>
...
...
<!--
after wml-image-extractor transformation document contains references
to "extracted-*.jpg"
automaticaly generated fro transformer.
this match convert those content upon request
to jpg. i have test it only with .jpgs
-->
<map:match pattern="extracted-*.jpg">
<map:generate src="{1}" type="extractor"/>
<map:transform src="osml/plugins/svg.xsl">
<map:parameter name="image" value="{1}"/>
</map:transform>
<map:serialize type="svg2jpeg"/>
</map:match>
wml-image.xsl:
<?xml version="1.0" encoding="ISO-8859-7"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
xmlns:fe="http://apache.org/cocoon/fragmentextractor/2.0">
<xsl:template match="/">
<xsl:apply-templates select="//w:body"/>
</xsl:template>
<xsl:template match="fe:fragment">
<img>
<xsl:attribute name="src">extracted-<xsl:value-of
select="@fragment-id"></xsl:value-of>.jpg</xsl:attribute>
</img>
</xsl:template>
<xsl:template match="node()|@*" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
svg.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:template match="/">
<xsl:variable name="style" select="descendant::v:shape/@style"/>
<xsl:variable name="width"
select="substring-before(substring-after($style, 'width:'),';')"/>
<xsl:variable name="height" select="substring-after($style,'height:')"/>
<svg xmlns="http://www.w3.org/2000/svg">
<xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute>
<xsl:attribute name="height"><xsl:value-of select="$height"/></xsl:attribute>
<title>Embedded Word 2003 Image</title>
<g>
<image xmlns:xlink="http://www.w3.org/1999/xlink">
<xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute>
<xsl:attribute name="height"><xsl:value-of
select="$height"/></xsl:attribute>
<xsl:attribute
name="xlink:href">data:image/wmf;base64,<xsl:value-of
select="descendant::w:binData/."/></xsl:attribute>
</image>
</g>
</svg>
</xsl:template>
</xsl:stylesheet>
rest .xsl just render wml some wml elements the way i want.
The key here is FragmentExtractorTranformer
Hope that this can help you
See it live:
http://www.nativus.gr/activity_id=multi1.html
Here both content and images are located into a .wml file saved from
msword and rendered on-demand.
If you loose your way i'm able to give you compete sources from this
web site. You have to be patient of course to find some time to pack
it.
/stavros
On 8/14/07, Lincoln Mitchell <li...@interfaces-n-creatives.com> wrote:
> Thanks for the reply but I can't yet fill in the blanks. You say:
> > create the binary file, name it as .zip, unzip it and you have a
> > windows meta file.
>
> I assume you can do this all via the sitemap some how?
> I found that 2.1.10 has a zip Source example. However, the example is about
> getting test.xml from the external zip file...
> <map:match pattern="zip/test.xml">
> <map:generate src="zip:test.zip!/test.xml"/>
> <map:serialize type="xml"/>
> </map:match>
> ...and I need to generate from the wordml code:
> <w:binData w:name="wordml://08000001.wmz...
>
> Can this all be done from the site map?
> If so I imagine I will need to generate from a xml fragment (if that's the
> right term) somehow.
> Am I on the right track?
>
> Thanks very much for the help.
>
> Linc
>
> > -----Original Message-----
> > From: Stavros Kounis [mailto:skounis@gmail.com]
> > Sent: Monday, 13 August 2007 10:39 PM
> > To: Lincoln Mitchell
> > Subject: Re: MathType 2 jpg
> >
> > Hi lincoln
> >
> > <w:binData> section contains a base64 encoded Compressed Windows Metafile
> > (WMZ)
> >
> > for example
> > create the binary file, name it as .zip, unzip it and you have a
> > windows meta file.
> >
> >
> > /stavros
> >
> >
> >
> > On 8/13/07, Lincoln Mitchell <li...@interfaces-n-creatives.com> wrote:
> > > I am trying to use "Microsoft Equation" or MathType to create an
> > Equation
> > > in word2003/Wordml and serialise the result as JPEG or GIF.
> > > However, the <w:binData references a ".wmz" and I don't know how to
> > process
> > > this. Ie:
> > > <w:binData w:name="wordml://08000001.wmz">
> > > There is also a .mso reference on an earlier binDdata:
> > > <w:binData w:name="oledata.mso">
> > >
> > > There was an earlier thread on this in 2004 from Stavros Kounis .
> > > Subject: ms word xml and embedded images
> > >
> > > But didn't seem to propose a solution - unless I missed something.
> > >
> > > Any clues appreciated
> > > Linc
> > >
> > >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: MathType 2 jpg
Posted by Lincoln Mitchell <li...@interfaces-n-creatives.com>.
Thanks for the reply but I can't yet fill in the blanks. You say:
> create the binary file, name it as .zip, unzip it and you have a
> windows meta file.
I assume you can do this all via the sitemap some how?
I found that 2.1.10 has a zip Source example. However, the example is about
getting test.xml from the external zip file...
<map:match pattern="zip/test.xml">
<map:generate src="zip:test.zip!/test.xml"/>
<map:serialize type="xml"/>
</map:match>
...and I need to generate from the wordml code:
<w:binData w:name="wordml://08000001.wmz...
Can this all be done from the site map?
If so I imagine I will need to generate from a xml fragment (if that's the
right term) somehow.
Am I on the right track?
Thanks very much for the help.
Linc
> -----Original Message-----
> From: Stavros Kounis [mailto:skounis@gmail.com]
> Sent: Monday, 13 August 2007 10:39 PM
> To: Lincoln Mitchell
> Subject: Re: MathType 2 jpg
>
> Hi lincoln
>
> <w:binData> section contains a base64 encoded Compressed Windows Metafile
> (WMZ)
>
> for example
> create the binary file, name it as .zip, unzip it and you have a
> windows meta file.
>
>
> /stavros
>
>
>
> On 8/13/07, Lincoln Mitchell <li...@interfaces-n-creatives.com> wrote:
> > I am trying to use "Microsoft Equation" or MathType to create an
> Equation
> > in word2003/Wordml and serialise the result as JPEG or GIF.
> > However, the <w:binData references a ".wmz" and I don't know how to
> process
> > this. Ie:
> > <w:binData w:name="wordml://08000001.wmz">
> > There is also a .mso reference on an earlier binDdata:
> > <w:binData w:name="oledata.mso">
> >
> > There was an earlier thread on this in 2004 from Stavros Kounis .
> > Subject: ms word xml and embedded images
> >
> > But didn't seem to propose a solution - unless I missed something.
> >
> > Any clues appreciated
> > Linc
> >
> >
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org