XML sample |
Top Previous Next |
<pdroot> <pdxsl OutputType="FO"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes"/> <xsl:template match="*|/"> <fo:table border="solid black 1px" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:apply-templates select="//Schema"/> <xsl:apply-templates select="//Records"/> </fo:table> </xsl:template> <xsl:template match="Schema"> <fo:table-header xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:apply-templates select="Field" mode="WriteHeader"/> </fo:table-header> </xsl:template> <xsl:template match="Field" mode="WriteHeader"> <fo:table-cell display-align="center" border="solid black 1px" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:block> <xsl:value-of select="Name"/> </fo:block> </fo:table-cell> </xsl:template> <xsl:template match="Records"> <fo:table-body xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:apply-templates select="Record"/> </fo:table-body> </xsl:template> <xsl:template match="Record"> <fo:table-row xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:apply-templates select="Field" mode="WriteRow"/> </fo:table-row> </xsl:template> <xsl:template match="Field" mode="WriteRow"> <fo:table-cell display-align="center" border="solid black 1px" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:block> <xsl:value-of select="Value"/> </fo:block> </fo:table-cell> </xsl:template> </xsl:stylesheet> </pdxsl> <pdxsl OutputType="HTML"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" indent="yes"/> <xsl:template match="*|/"> <table border="1"> <xsl:apply-templates select="//Schema"/> <xsl:apply-templates select="//Records"/> </table> </xsl:template> <xsl:template match="Schema"> <tr> <xsl:apply-templates select="Field" mode="WriteHeader"/> </tr> </xsl:template> <xsl:template match="Field" mode="WriteHeader"> <td> <xsl:value-of select="Name"/> </td> </xsl:template> <xsl:template match="Records"> <xsl:apply-templates select="Record"/> </xsl:template> <xsl:template match="Record"> <tr> <xsl:apply-templates select="Field" mode="WriteRow"/> </tr> </xsl:template> <xsl:template match="Field" mode="WriteRow"> <td> <xsl:value-of select="Value"/> <xsl:value-of select="' '"/> </td> </xsl:template> </xsl:stylesheet> </pdxsl> <pdxsl OutputType="CSV"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/> <xsl:template match="*|/"> <xsl:apply-templates select="//Records"/> </xsl:template> <xsl:template match="Records"> <xsl:apply-templates select="Record"/> </xsl:template> <xsl:template match="Record"> <xsl:for-each select="Field"> <xsl:value-of select="Value"/> <xsl:if test="position() != last()"> <xsl:value-of select="','"/> </xsl:if> </xsl:for-each> <xsl:value-of select="' '"/> </xsl:template> </xsl:stylesheet> </pdxsl> <Settings/> </pdroot>
|