Я использую SSIS на SQL Server 2005, VS 2005 с пакетом обновления 2 (SP2).
Я создал XSLT для преобразования XML в формат CSV. Когда я запускаю это через XML Spy, он работает нормально. Я настроил задачу XML внутри и пакет служб SSIS для преобразования файла XML. К сожалению, когда SSIS выполняет преобразование, оно не включает CR / LF в конце каждой записи - у меня остается строка с символом.
Я поставил XSLT ниже. Кто-нибудь может сообщить мне, почему SSIS игнорирует & # xD;?
Я также вставил образец XML-документа.
Большое спасибо,
Rob.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/pptxn">
<xsl:variable name="fileName" select="/pptxn/file_name"/>
<xsl:variable name="sendingOrg" select="/pptxn/sending_org"/>
<xsl:variable name="dateCreated" select="/pptxn/date_created"/>
<xsl:variable name="timeCreated" select="/pptxn/time_created"/>
<xsl:variable name="sequenceNumber" select="/pptxn/sequence_number"/>
<xsl:text>FileName,SendingOrg,DateCreated,TimeCreated,SequenceNumber,PartnerNumber,PartnerOutletRef,CardAccountNumber,TransactionDate,TransactionTime,Spend,PartnerPoints,PartnerReference,PartnerPosId</xsl:text>
<xsl:text>
</xsl:text>
<xsl:for-each select="transaction">
<xsl:value-of select="$fileName"/>,<xsl:value-of select="$sendingOrg"/>,<xsl:value-of select="$dateCreated"/>,<xsl:value-of select="$timeCreated"/>,<xsl:value-of select="$sequenceNumber"/>,<xsl:value-of select="partner_number"/>,<xsl:value-of select="partner_outlet_ref"/>,<xsl:value-of select="card_account_number"/>,<xsl:value-of select="transaction_date"/>,<xsl:value-of select="transaction_time"/>,<xsl:value-of select="spend"/>,<xsl:value-of select="partner_points"/>,<xsl:value-of select="partner_reference"/>,<xsl:value-of select="partner_pos_id"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Теперь XML ->
<?xml version="1.0" encoding="UTF-8"?>
<pptxn xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Y:\PartnerPoints\XML\PointsPartnerRequest.xsd">
<file_name>PPRequest.xml</file_name>
<sending_org>1</sending_org>
<date_created>20091121</date_created>
<time_created>153421</time_created>
<sequence_number>2</sequence_number>
<transaction_count>3</transaction_count>
<transaction>
<partner_number>1</partner_number>
<partner_outlet_ref>outlet ref 1</partner_outlet_ref>
<card_account_number>1</card_account_number>
<transaction_date>20091221</transaction_date>
<transaction_time>091256</transaction_time>
<spend>21.34</spend>
<partner_points>40</partner_points>
<partner_reference>shop x1</partner_reference>
<partner_pos_id>pos id 1</partner_pos_id>
</transaction>
<transaction>
<partner_number>2</partner_number>
<partner_outlet_ref>outlet ref 2</partner_outlet_ref>
<card_account_number>2</card_account_number>
<transaction_date>20091222</transaction_date>
<transaction_time>091257</transaction_time>
<spend>21.35</spend>
<partner_points>41</partner_points>
<partner_reference>shop x2</partner_reference>
<partner_pos_id>pos id 2</partner_pos_id>
</transaction>
<transaction>
<partner_number>3</partner_number>
<partner_outlet_ref>outlet ref 3</partner_outlet_ref>
<card_account_number>3</card_account_number>
<transaction_date>20091223</transaction_date>
<transaction_time>091258</transaction_time>
<spend>21.36</spend>
<partner_points>42</partner_points>
<partner_reference>shop x3</partner_reference>
<partner_pos_id>pos id 3</partner_pos_id>
</transaction>
</pptxn>