私は以下のようなXMLを持っていますが、私はXSL FO XSLT transforamtionを使ってPDFを生成しています。 XML要素間にスペースを追加してPDFの表の列として表示する方法は?xml要素間にスペースを追加する方法xslt変換
<Reports>
<Report>
<BatchDate>2016-08-10T00:00:00</BatchDate>
<ClientAccountNo>ABCDE01384</ClientAccountNo>
<Source>N</Source>
<CDSNo>0000001387</CDSNo>
<Price>0.123000</Price>
<Qty>-1200</Qty>
<TCurrency>USD</TCurrency>
<TNettAmt>0</TNettAmt>
<LCurrency>USD</LCurrency>
<LNettAmt>-86.600000</LNettAmt>
<PromotionInd>N</PromotionInd>
<BrkChgID>BRK-N</BrkChgID>
<BrkChgAmt>50.000000</BrkChgAmt>
<ClrChgID>CLR</ClrChgID>
<ClrChgAmt>10.000000</ClrChgAmt>
<SdcChgID>SDC</SdcChgID>
<SdcChgAmt>1.000000</SdcChgAmt>
<BinChgID />
<BinChgAmt>0</BinChgAmt>
<OthChgAmt>0.000000</OthChgAmt>
<TaxAmt>0.000000</TaxAmt>
</Report>
</Reports>
上記のXMLをouputtingながら、私は、私たちはTaxAmtてみましょう、例えばのようなXML要素の間にスペースを追加する必要があり、私は税AMTのような出力にそれを必要とします。これどうやってするの?以下は私のXSLTです
<fo:table role="html:table" table-layout="auto" inline-progression-dimension="auto" line-height="2.5" width="100%" border="0px" border-collapse="collapse" border-spacing="3px" border-style="outset hidden" space-before.conditionality="retain" space-after.conditionality="retain" space-after="1em" space-before="1em">
<!--table header-->
<xsl:for-each select="//Reports/Report[1]/*">
<fo:table-column column-width="proportional-column-width(4.77)" font-family="sans-serif" font-size="medium" />
</xsl:for-each>
<fo:table-header>
<fo:table-row height="auto" color="#FFFFFF" background-color="#A1A1A1" text-align="center" font-weight="bold" font-family="sans-serif" font-size="medium">
<xsl:for-each select="/Reports/Report[1]/*">
<fo:table-cell text-align="center">
<fo:block font-size="medium" font-family="sans-serif">
<xsl:value-of select="name()"/>
</fo:block>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
</fo:table-header>
<!--table body-->
<fo:table-body>
<xsl:for-each select="/Reports/Report">
<fo:table-row display-align="before">
<xsl:for-each select="*">
<fo:table-cell text-align="center" border-top-color="rgb(255, 255, 255)" border-top-style="solid" border-width="1pt" padding="2pt">
<fo:block font-size="medium" font-family="sans-serif">
<xsl:text> </xsl:text> <xsl:value-of select="."/>
</fo:block>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
だけ明確にするために - あなたは前にすべてのスペースを追加することを意味要素名の大文字ですか?それがあなたが求めているものなら、あなたはそれを少し明確にすることができます。 –
私はすべてのXML要素を人間が理解できるように、レポートにレンダリングする必要があります。現在、私のXML要素はすべてデータベースの列です。例えば、私の場合、エンドユーザは取引通貨であるべき要素TCurrencyを理解できません。 –