对于下面的xml代码,我需要开发一个xsl-fo样式表,在xml中我有文本和行标签的混合,所以我创建了xsl-fo for line,如下所示,我需要的是我需要生成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 for line,如下所示
<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请帮帮我
答案 0 :(得分:0)
要获得此渲染的基本代码如下,我不会深入了解样式表本身的基础知识,因为网上有大量的教程可以覆盖它。
<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>