2010-05-24 75 views
0

爲下面的xml代碼我需要開發一個xsl-fo樣式表,在xml中我有文本和行標記的混合,所以我創建了xsl -fo爲行如下所示,我需要的是我需要生成類似於行我有下面的代碼,我需要開發xsl-fo文件,使用循環

*********************文本的xsl-fo ********* XML **************************************** **************

<?xml version="1.0" encoding="iso-8859-1"?> 
<!--<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">--> 
<!-- Generator: Arbortext IsoDraw 7.0 --> 
<svg width="100%" height="100%" viewBox="0 0 214.819 278.002"> 
<g id="Catalog"> 

    <text transform="matrix(0.984 0 0 0.93 183.515 265.271)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174"/> 
    <text transform="matrix(0.994 0 0 0.93 7.235 265.3)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174">087156-8-</text> 
    <text transform="matrix(0.995 0 0 0.93 21.708 265.357)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174" font-weight="bold">AB</text> 
    <text x="103.292" y="265.298" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174">P. 1/1</text> 
    <text transform="matrix(0.994 0 0 0.93 192.812 8.076)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="4.586" font-weight="bold">Fittings</text> 
    <text transform="matrix(0.994 0 0 0.93 188.492 13.323)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="4.586" font-weight="bold">Raccords</text> 
    <text transform="matrix(0.994 0 0 0.93 183.431 18.571)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="4.586" font-weight="bold">Conexiones</text> 
<line stroke-width="0.088" stroke-linecap="butt" stroke-dasharray="2.822 1.058" x1="58.445" y1="53.612" x2="53.893" y2="50.981"/> 
    <line stroke-width="0.088" stroke-linecap="butt" x1="53.893" y1="50.981" x2="53.027" y2="50.479"/> 
    <line stroke-width="0.088" stroke-linecap="butt" stroke-dasharray="2.822 1.058" x1="61.24" y1="63.011" x2="61.24" y2="60.454"/> 
    <line stroke-width="0.088" stroke-linecap="butt" x1="61.24" y1="60.454" x2="61.24" y2="59.454"/> 
    <line stroke-width="0.088" stroke-linecap="butt" stroke-dasharray="2.822 1.058" x1="131.919" y1="56.159" x2="131.919" y2="55.042"/> 
    <line stroke-width="0.088" stroke-linecap="butt" x1="131.919" y1="55.042" x2="131.919" y2="54.042"/> 
     <line stroke-width="0.088" stroke-linecap="butt" stroke-dasharray="2.822 1.058" x1="126.572" y1="110.132" x2="126.572" y2="106.606"/> 
     <line stroke-width="0.088" stroke-linecap="butt" x1="126.572" y1="106.606" x2="126.572" y2="105.606"/> 
    <line stroke-width="0.088" stroke-linecap="butt" stroke-dasharray="2.822 1.058" x1="73.59" y1="127.903" x2="71.022" y2="129.699"/> 

</g> 
</svg> 

***************************** ******* XSL-FO **************************************** *********
我爲線創建了xslfo,如下所示

<xsl:for-each select="svg/g/line"> 
    <xsl:variable name="x1" select="@x1"/> 
    <xsl:variable name="x2" select="@x2"/> 
    <xsl:variable name="y1" select="@y1"/> 
    <xsl:variable name="y2" select="@y2"/> 
    <svg:g style=" stroke:black;stroke-width:0.088; stroke-linecap:butt;stroke-dasharray:2.822 1.058"> 
    <svg:line x1="{$x1}" y1="{$y1}" x2="{$x2}" y2="{$y2}"/> 
    </svg:g> 
</xsl:for-each> 

所以在類似的方式,我該怎麼辦的XSL-FO文字請幫我

+1

你需要問一個具體的問題,我們可以回答。 – 2010-05-24 17:46:54

+2

只是粘貼一些代碼並不是真的在問一個問題。你需要寫一個更清晰的問題,解釋你的要求,以及在這裏有人可以幫助你之前有什麼問題。 – Oded 2010-05-24 17:47:20

回答

0

Basic代碼得到這個渲染低於,我不會進入樣式表的基礎知識本身,因爲網絡上有很多教程涵蓋了這一點。

<fo:block> 
<fo:instream-foreign-object> 
    <svg:svg xmlns:svg="http://www.w3.org/2000/svg" width="600" height="600"> 
     <svg:text transform="matrix(0.984 0 0 0.93 183.515 265.271)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174"/> 
     <svg:text transform="matrix(0.994 0 0 0.93 7.235 265.3)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174">087156-8-</svg:text> 
     <svg:text transform="matrix(0.995 0 0 0.93 21.708 265.357)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174" font-weight="bold">AB</svg:text> 
     <svg:text x="103.292" y="265.298" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="3.174">P. 1/1</svg:text> 
     <svg:text transform="matrix(0.994 0 0 0.93 192.812 8.076)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="4.586" font-weight="bold">Fittings</svg:text> 
     <svg:text transform="matrix(0.994 0 0 0.93 188.492 13.323)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="4.586" font-weight="bold">Raccords</svg:text> 
     <svg:text transform="matrix(0.994 0 0 0.93 183.431 18.571)" stroke="none" fill="#000000" font-family="'Helvetica'" font-size="4.586" font-weight="bold">Conexiones</svg:text> 
    </svg:svg> 
</fo:instream-foreign-object> 
</fo:block>