2017-07-26 2 views
1

SQLクエリに基づいてCSVファイルを作成するには、助けが必要です。すべては私が各値の定義済みの値をCSVにヘッダー行を追加する必要があるという事実を除いて、正常に動作しますXSLを使用してSQLクエリからCSVを作成

<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> 

これは次のように現在のXSLがどのように見えるかです。どうやってやるの?

これが今どのように見えるかです:enter image description here

これは私がCSVが見えるようにする方法である:enter image description here

答えて

0

は、例えば追加

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

ここで、foo,bar,bazはあなたの列名です。

+0

こんにちは!どうもありがとう! –

関連する問題