Register  Login       Search  
Forum  
 
  
 
Forum  Forum     
 
SearchForum Home
  XML  Employing XML in .NET  wordml2html...
 wordml2html
 
kyern
4 posts
Joined
10/11/2006

wordml2html
Posted: 11 Oct 06 7:36 AM (United States)

Hello, I first want to say thank you for creating the image addition to the word2html xslt, for the most part it works fantastic.  Is there any way to convert images created though words drawing toobar though? I have many shapes that don't get converted over.  Any help would be appreciated

Thanks

David

kyern
4 posts
Joined
10/11/2006

Re: wordml2html
Posted: 11 Oct 06 10:07 AM (United States)

I have done some research about this now, and looks like this should be easy.  All of the drawings are in vml.  I removed the v from the exlude list at the top and that gets me the vml namespace.  I just need to figure out a way to make it so the v: items are being put back into my html document.  I did a manual test and it works perfect.  I guess i just need to figure out how to copy v:rect ect to the transformed document.

David

kyern
4 posts
Joined
10/11/2006

Re: wordml2html
Posted: 11 Oct 06 12:08 PM (United States)
Hmm..  I have it completely working now.  You may want to add this to the next version.

here is your w:pict template

<xsl:template match="w:pict">
  <xsl:choose>
   <xsl:when test="w:binData">
    <xsl:variable name="dir">
     <!-- We need something unique instead of document name -->
     <!-- Let's take first 10 characters of title -->
     <xsl:value-of select="translate(substring($ndOfficeDocPr/o:Title, 1, 10), ' ', '_')"/>
     <xsl:text>_files</xsl:text>  
    </xsl:variable>
       <img src="{ext:decodePicture(w:binData, $base-dir-for-images, $base-virtual-dir-for-images,
           $dir, substring-after(w:binData/@w:name, 'wordml://'))}" alt="{v:shape/v:imagedata/@o:title}" style="{v:shape/@style}" title="{v:shape/v:imagedata/@o:title}"/>
   </xsl:when>
   <xsl:otherwise>
     <xsl:copy>
        <xsl:apply-templates/>
      </xsl:copy>
   </xsl:otherwise>
  </xsl:choose>
</xsl:template>

then just change line 27 to:

exclude-result-prefixes="msxsl ext w o WX aml w10">

thats it!

olegt
85 posts
www.xmllab.net
Joined
2/25/2005

Re: wordml2html
Posted: 19 Oct 06 12:57 AM (Israel)

Thanks for the research. I'll update the stylesheet.

Btw, I found out VML's <v:imagedata> works better for Internet Explorer than <img>. So I'm going to produce conditional markup (<!--[if vml]--> sort of thing so IE will work with VML only and the rest - <img>).


Oleg Tkachenko, Microsoft MVP for XML, MCPD
http://www.XmlLab.Net | http://blog.tkachenko.com
  XML  Employing XML in .NET  wordml2html...
Forum Home  Search