xml - Use XSLT 2.0 to display an image from a directory -


team,

i'm using xlst 2.0 create ms word documents xml data. i'm working on creating header , want call in image file local directory display our company logo. software i'm using, unable use ms word template call. billing software , needs create each ms word document on fly each time bill (using xml data) get's thrown @ it.

i've searched site extensively , tried majority of examples given no avail. assistance or guidance appreciated.

here result of header in ms word doc want create...

enter image description here

here xsl header...

<xsl:stylesheet xmlns:aml="http://schemas.microsoft.com/aml/2001/core"      xmlns:dt="uuid:c2f41010-65b3-11d1-a29f-00aa00c14882"      xmlns:fo="http://www.w3.org/1999/xsl/format"      xmlns:kmf="http://www.kleinmundo.com/functions"      xmlns:o="urn:schemas-microsoft-com:office:office"      xmlns:sl="http://schemas.microsoft.com/schemalibrary/2003/core"      xmlns:tlr="http://www.elite.com/functions"      xmlns:st1="urn:schemas-microsoft-com:office:smarttags"      xmlns:v="urn:schemas-microsoft-com:vml"      xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"      xmlns:w10="urn:schemas-microsoft-com:office:word"      xmlns:wsp="http://schemas.microsoft.com/office/word/2003/wordml/sp2"      xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxhint"      xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="2.0">      <xsl:template name="xs_header" xml:space="default">         <xsl:variable name="tw" select="1440" />         <xsl:variable name="image-dir" select="'/images'" />         <w:sectpr>             <w:hdr w:type="first">                 <w:tbl>                     <xsl:variable name="col1" select="2 * $tw" />                     <xsl:variable name="col2" select="5.5 * $tw" />                     <w:tblpr>                         <w:tblw w:w="0" w:type="dxa"/>                         <w:tblcellmar>                             <w:left w:w="0" w:type="dxa"/>                             <w:right w:w="0" w:type="dxa"/>                         </w:tblcellmar>                     </w:tblpr>                     <w:tblgrid>                         <w:gridcol w:w="{$col1}"/>                         <w:gridcol w:w="{$col2}"/>                     </w:tblgrid>                     <w:tr>                         <w:trpr>                             <w:cantsplit/>                             <w:tblheader/>                         </w:trpr>                         <!--logo column -->                         <w:tc>                             <w:tcpr>                                 <w:tcw w:w="{$col1}" w:type="dxa"/>                                 <w:valign w:val="bottom"/>                             </w:tcpr>                             <w:p>                                 <w:ppr>                                     <w:keepnext/>                                     <w:keeplines/>                                 </w:ppr>                                 <w:r>                                     <w:t>logo here</w:t>                                 </w:r>                             </w:p>                         </w:tc>                         <!-- address info column -->                         <w:tc>                             <w:tcpr>                                 <w:tcw w:w="{$col2}" w:type="dxa"/>                                 <w:valign w:val="bottom"/>                             </w:tcpr>                             <w:p>                                 <w:ppr>                                     <w:keepnext/>                                     <w:keeplines/>                                     <w:jc w:val="right" />                                 </w:ppr>                                 <w:r>                                     <w:rpr>                                         <w:sz w:val="16" />                                     </w:rpr>                                     <w:t>company address  |  city, state  zip  |  tel 555.555.1234  |  fax 555.555.4321</w:t>                                 </w:r>                             </w:p>                         </w:tc>                     </w:tr>                 </w:tbl>                 <w:sectpr>                     <w:pgsz w:w="12240" w:h="15840" w:orient="portrait" w:code="1" />                     <w:pgmar w:top="720" w:right="720" w:bottom="720" w:left="720" w:header="720" w:footer="720" w:gutter="0" />                     <w:cols w:space="720" />                     <w:titlepg />                     <w:docgrid w:line-pitch="272" />                 </w:sectpr>             </w:hdr>             <w:titlepg />             <w:hdr w:type="odd">             </w:hdr>             <w:ftr w:type="first">                 <w:p>                     <w:r>                         <w:t />                     </w:r>                 </w:p>             </w:ftr>             <w:titlepg />             <w:ftr w:type="odd">                 <w:p>                     <w:r>                         <w:t />                     </w:r>                 </w:p>             </w:ftr>             <w:pgnumtype w:start="1" />             <w:cols w:space="720" />         </w:sectpr>     </xsl:template> </xsl:stylesheet> 

-nick

figured 1 out on own. here's did.

i created docx file image in body of document. created bookmark image highlighted , named bookmark "logo". saved docx file c:\images\logo_template.docx

i went xslt file , called docx file pointing bookmark follows:

<w:p>   <w:r>     <w:t>       ~ins~<xsl:value-of select"'c:\images\logo_template.docx|logo'" />~/ins~     </w:t>   </w:r> </w:t> 

this tossed image file generated ms word file i'm compiling bill generating software.

best regards,

-nick


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -