开发者

i have code below where i need to develop the xsl-fo file using loop

for the below xml code i need to develop a xsl-fo style sheet,in the xml i have mixture of text and line tag so i created xsl-fo for line as shown below,what i need is i need to generate the xsl-fo for text similar to line

******************************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**************************************开发者_运维技巧***********

I created xslfo for line as shown below

<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>

so in the similar way how can i do the xsl-fo for text please help me


Basic code to get this to render is below, i'll not go into the basics of the stylesheet itself as there are plenty of tutorials on the web that cover that.

<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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜