我是XSL转换的新手,我需要通过XSL转换将XML中的所有值打印到生成的PDF中,而无需标头,而只需像这样的值:
--------------------------
|Cash | 100 |
|Credit Card | 46.1 |
|Debit Card | 14 |
--------------------------
我有这样的XML:
<Transaction>
<Id>1</Id>
<Type>Cash</Type>
<Amount>100</Amount>
</Transaction>
<Transaction>
<Id>2</Id>
<Type>Credit Card</Type>
<Amount>46.1</Amount>
</Transaction>
<Transaction>
<Id>3</Id>
<Type>Debit Card</Type>
<Amount>14</Amount>
</Transaction>
我已经创建了转换,但是它没有出现在结果PDF中:
<xsl:template name="Transactions">
<xsl:variable name="field">
<Field FieldId="Type" Identifier="Type" Label="Type" Type="TextBox" Path="//Transactions" />
<Field FieldId="Amount" Identifier="Amount" Label="Amount" Type="currency" Path="//Transactions" />
</xsl:variable>
<xsl:variable name="fields" select="msxsl:node-set($field)/Field"/>
<fo:table keep-together="auto" space-before="2mm">
<fo:table-column column-width="proportional-column-width(10)" number-columns-repeated="2"/>
<fo:table-body>
<out:for-each select="//Transactions">
<out:variable name="Type" select="Type"/>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="tableCell" font-weight="bold" number-columns-spanned="4" background-color="{$subheadingcolour}">
<fo:block>
<out:value-of select="Name"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<out:for-each select="//Transactions[Type=$Type]">
<fo:table-row>
<xsl:for-each select="$fields">
<fo:table-cell xsl:use-attribute-sets="tableCell">
<xsl:call-template name="field"/>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
</out:for-each>
</out:for-each>
</fo:table-body>
</fo:table>
</xsl:template>
我在做什么错?