使用XSL从SQL查询创建CSV
我需要帮助创建一个基于SQL查询的CSV文件 以下是当前XSL的外观:使用XSL从SQL查询创建CSV,sql,csv,xslt,header,Sql,Csv,Xslt,Header,我需要帮助创建一个基于SQL查询的CSV文件 以下是当前XSL的外观: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" encoding="iso-8859-1"/> <xsl:param name="fieldNames" select="'yes'" /> <xsl:template ma
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="iso-8859-1"/>
<xsl:param name="fieldNames" select="'yes'" />
<xsl:template match="NewDataSet">
<xsl:text></xsl:text>
<xsl:apply-templates select="Table"/>
</xsl:template>
<xsl:template match="Table">
<xsl:for-each select="*">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:value-of select="','"/>
</xsl:if>
</xsl:for-each>
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>
除了我需要在CSV中添加一个标题行以及每个值的预定义值之外,一切都正常。我该怎么做
这就是它现在的样子:
这就是我希望CSV看起来的样子:添加例如
<xsl:template match="/">
<xsl:text>foo,bar,baz
</xsl:text>
<xsl:apply-templates/>
</xsl:template>
福、巴、巴
其中foo、bar、baz将是您的列名。添加例如
<xsl:template match="/">
<xsl:text>foo,bar,baz
</xsl:text>
<xsl:apply-templates/>
</xsl:template>
福、巴、巴
其中foo、bar、baz将是您的列名。Hi Martin!谢谢!嗨,马丁!谢谢!