XML および XSLT ファイルを使用して PDF を出力するために FOP を実装しようとしています。
私の問題は次のとおりです。たとえば、行内の単語の位置を修正する必要があります(ただし、テーブルを使用する必要はありません)。
私は次のxmlを持っています:
<address>
<Line1 length="32" noLine="5" col="60" />
<Line2 length="32" noLine="6" col="60">Mr. John Kane</Line2 >
<Line3 length="32" noLine="7" col="60">15 Street Springfield</Line3 >
<Line4 length="32" noLine="8" col="60" />
<Line5 length="32" noLine="9" col="60" />
<Line6 length="6" noLine="10" col="60">75009</Line6 >
<Line7 length="25" noLine="10" col="67">Freesberg</Line7 >
<Line8 length="25" noLine="11" col="67">Idaho</Line8 >
</address>
- は単語
length
/文の長さです noLine
行番号ですcol
行内の単語/文の開始位置です
行を作成しましたが、単語/文を行の正しい位置 (列) に挿入できないようです。
これは私の xslt の一部です:
<fo:block font-size="10" font-family="monospace">
<xsl:for-each select="*">
<xsl:variable name="currentNode" select ="name(.)"/>
<xsl:choose>
<xsl:when test="$currentNode = 'address'">
<xsl:for-each select="*">
<xsl:variable name="length" select ="@length"/>
<xsl:variable name="noLine" select ="@noLine"/>
<xsl:variable name="col" select ="@col"/>
<xsl:variable name="precNoLig" select = "preceding-sibling::*[1]/@noLine"/>
<xsl:choose>
<xsl:when test="$precNoLig = $noLine">
<fo:block font-size="10" font-family="monospace" text-indent="60">
 <xsl:value-of select="." />
</fo:block>
</xsl:when>
<xsl:otherwise>
<!--<fo:block font-size="10" font-family="monospace" >-->

<xsl:value-of select="." />
<!--</fo:block>-->
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</fo:block>
これは次のように期待される出力PDF
です。
Mr. John Kane
15 Street Springfield
75009 Freesberg
Idaho
PDF
(col)に次の位置があります。
<-----------------60-------------------->
<-----------------60-------------------->Mr. John Kane
<-----------------60-------------------->15 Street Springfield
<-----------------60-------------------->
<-----------------60-------------------->
<-----------------60-------------------->75009 Freesberg
<-----------------67-------------------------->Idaho
どんな助けでも大歓迎です。