XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Ivan SleeckxSubject: XSLT, WordML and MSXML
Author: Ivan Sleeckx
Date: 06 Feb 2007 09:09 AM
Hi,

I'm currently working on a WordML document. (XML to WordML through XSLT)
The document contains images. Now, I know XSLT doesn't like the base64 code of images, it seems you can link the document to external images.

In a stylesheet this is done like so:

<w:pict>
<v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype>
<w:binData w:name="frontpagePic.PNG"></w:binData>
<v:shape id="_x0000_s1041" type="#_x0000_t75" alt="frontpagePic" style="position:absolute;left:0;text-align:left;margin-left:254pt;margin-top:439.3pt;width:285.3pt;height:284pt;z-index:-929;mso-wrap-edited:f;mso-position-horizontal-relative:page;mso-position-vertical-relative:page"
o:allowincell="f">


<v:imagedata src="C:\frontpagePic.PNG" />



<w10:wrap anchorx="page" anchory="page"/>
</v:shape>
</w:pict>


Now, I want the pictures to be changes dynamically (i.e. depending on what URL is provided in the XML. To get this done,
I've tried the following:

1. a simple src attribute
<v:imagedata>
<xsl:attribute name="src"><xsl:value-of select="myXPath/photourl" /></xsl:attribute>
</v:imagedata>

2. an enhanced url
<v:imagedata>
<xsl:attribute name="src"><xsl:value-of select="concat('file&#58;&#47;&#47;&#47;',myXPath/photourl)"/></xsl:attribute>
</v:imagedata>

3. a creative *cough* solution
<![CDATA[<v:imagedata src="]]><xsl:value-of select="myXPath/photourl" /><![CDATA["/>]]>

4: another creative *cough* solution
<xsl:value-of select="concat('&lt;v&#58;imagedata src&#61;&#34;file&#58;&#47;&#47;&#47;',myXPath/photourl,'&#34;&#47;&gt;')" />


All of these seem to work, when I use Stylus Studio's built-in processor or MSXML .NET. (What I do is generate a preview, save it and open the XML doc in Word.) Note: for the last two solutions Stylus Studio gives the expected warning that "the output document cannot be parsed as XML".

When I use an external MSXML processor however it doesn't seem the work. The src attrribute of the <v:imagedata> element is either empty or it's a text string (as expected).

Any ideas are welcome, since I ran out of them. Thank you.

Postnext
Ivan PedruzziSubject: XSLT, WordML and MSXML
Author: Ivan Pedruzzi
Date: 06 Feb 2007 10:49 AM

Try using an attribute value template
<v:imagedata src="{myXPath/photourl}"/>

if you need a prefix
<v:imagedata src="{concat('c:\', myXPath/photourl)}"/>

Hope this helps
Ivan Pedruzzi
Stylus Studio Team
http://www.stylusstudio.com/xml_download.html

Posttop
Ivan SleeckxSubject: XSLT, WordML and MSXML
Author: Ivan Sleeckx
Date: 07 Feb 2007 04:49 AM
Works perfectly! Didn't know yet about those attribute value templates. Thanks a lot!

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.