Conversion error records of XSLT style sheets in Microsoft Bi SSIS series-XML tasks

Source: Internet
Author: User
Tags xsl xslt ssis
Introduction

This article specifically records the Syntax problems in the conversion process of XSLT style sheets.

Incorrect value and attribute inversion

The style sheet has been modified several times, but an error is reported as before. The error message is as follows:

[XML task] error: An error occurred with the following error message: "attribute and namespace nodes cannot be added to the parent element after a text, comment, PI, or sub-element node has already been added. ".

Obviously, the XML task has told you the cause of the error, that is, the attribute or namespace definition cannot follow an existing document.

Correct syntax:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml" indent="yes"/><xsl:template match="/">     <newsalesorder>    <xsl:for-each select="SalesOrder/SalesOrderDetail">        <salesorderdetail>            <salesorderID>                <xsl:attribute name="detailID">                    <xsl:value-of select="SalesOrderDetailID"/>                </xsl:attribute>                <xsl:value-of select="SalesOrderID"/>            </salesorderID>         </salesorderdetail>    </xsl:for-each>     </newsalesorder></xsl:template></xsl:stylesheet> 

Incorrect syntax-when the salesorderid is converted to an XML task, once the value of the source salesorderid is written, the latter is incorrect with attribute, and the former is attribute.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml" indent="yes"/><xsl:template match="/">     <newsalesorder>    <xsl:for-each select="SalesOrder/SalesOrderDetail">        <salesorderdetail>            <salesorderID>                <xsl:value-of select="SalesOrderID"/>                <xsl:attribute name="detailID">                    <xsl:value-of select="SalesOrderDetailID"/>                </xsl:attribute>            </salesorderID>         </salesorderdetail>    </xsl:for-each>     </newsalesorder></xsl:template></xsl:stylesheet> 

The attribute detailid must be defined before salesorderid 71774 in the correct output segment.

<?xml version="1.0" encoding="utf-8"?><newsalesorder>  <salesorderdetail>    <salesorderID detailID="110562">71774</salesorderID>  </salesorderdetail>  <salesorderdetail>    <salesorderID detailID="110563">71774</salesorderID>  </salesorderdetail>  <salesorderdetail>    <salesorderID detailID="110567">71776</salesorderID>  </salesorderdetail>
Related Resources

XSLT tutorial

For more bi articles, see the Bi series Essays (SSIS, SSRS, SSAs, MDX, SQL Server, to help others quickly see these articles in the recommendation bar of the biwork blog.

Conversion error records of XSLT style sheets in Microsoft Bi SSIS series-XML tasks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.