我想在线生成xslt tranformation之类的PDF
输入XML:
<?xml version="1.0" encoding="UTF-8"?>
<students>
<student>
<name>Amrendra Kumar</name>
<class>BCA</class>
</student>
<student>
<name>Sanjeev Kumar</name>
<class>MCA</class>
</student>
</students>
XSLT生成PDF:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="a">
<fo:region-body margin="1in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="a">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:table border="1pt">
<fo:table-column column-number="1" column-width="180pt"/>
<fo:table-column column-number="2" column-width="300pt"/>
<fo:table-header>
<fo:table-row padding-top="0pt" padding-bottom="0pt">
<fo:table-cell>
<fo:block font-family="TimesNewRoman" font-size="10pt" space-before="4pt" text-align="left">
<fo:inline font-weight="bold" font-size="12pt">Name</fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-family="TimesNewRoman" font-size="10pt" space-before="4pt" text-align="left">
<fo:inline font-weight="bold" font-size="12pt">Class</fo:inline>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body start-indent="0pt" end-indent="0pt">
<xsl:for-each select="students/student">
<fo:table-row padding-top="0pt" padding-bottom="0pt">
<fo:table-cell>
<fo:block font-family="TimesNewRoman" font-size="10pt" space-before="4pt" text-align="left">
<fo:inline font-size="12pt">
<xsl:value-of select="name"/>
</fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-family="TimesNewRoman" font-size="10pt" space-before="4pt" text-align="left">
<fo:inline font-size="12pt">
<xsl:value-of select="class"/>
</fo:inline>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
输出:需要在线生成PDF