1
我使用XLST 2.0從XML數據創建MS Word文檔。我正在創建一個標題,並希望從本地目錄調用圖像文件來顯示我們的公司徽標。使用我正在使用的軟件,我無法使用MS Word模板進行調用。這是計費軟件,每次使用XML數據時,都需要隨時創建每個MS Word文檔。
我已經廣泛搜索這個網站,並試圖給大多數的例子無濟於事。任何援助或指導將不勝感激。
這是在MS Word文檔,我想創建標題的結果...
這裏是我的XSL的頭...
<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>
- 尼克
XSLT不顯示任何圖像,它需要輸入文檔並創建一些結果文檔。這當然可以是HTML瀏覽器可以呈現的格式,也可以包含圖像。您想用XSLT創建哪種MS Word格式?你能向我們展示一個輸入樣本,你有XSLT和你想創建的結果嗎? –
已將XSLT添加到原始帖子中。謝謝。 – NCollinsTE