Create a CSV from a SQL query using XSL -


i need create csv file based on sql query.

this how current xsl looks like:

<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>&#10;</xsl:text> </xsl:template> </xsl:stylesheet> 

everything works fine, except fact need add header row in csv predefined values each value. how can that?

this how looks now: enter image description here

this how want csv like: enter image description here

add e.g.

<xsl:template match="/">   <xsl:text>foo,bar,baz </xsl:text>   <xsl:apply-templates/> </xsl:template> 

where foo,bar,baz column names.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -