Search code examples
xmlazurexsltbiztalkedi

Syntax error: X cannot be a child of the 'xsl:element' element


I am using the Azure integration tools(used to be the BizTalk mapper) to translate an inbound 856. To start, I am just trying to get a working map and have copied verbatim a script from the Pro Mapping in BizTalk 2009 book by Jim Dawson and I am using his example input and output. I am encountering the following error output

'xsl:elemment' cannot be a child of the 'xsl:element' element."

Here is my XSLT script:

<xsl:variable name="RailRoadCar" select="concat(//s0:TD3/TD302,//s0:TD3/TD303)"/>
<xsl:variable name="OrderNum" select="//s0:PRF/PRF01"/>

<xsl:for-each select="//s0:HLLoop1[s0:HL/HL03='I']/s0:MAN[not(MAN02=preceding::s0:MAN/MAN02)]">
    <xsl:variable name="ItemID" select="MAN02"/>
    <xsl:element name="s0:ItemLoop">
        <xsl:element name="ItemID"><xsl:value-of select="$ItemID"/></xsl:element>
        <xsl:element name="OrderNum"><xsl:value-of select="OrderNum"/></xsl:element>
        <xsl:element name="RailRoadCar"><xsl:value-of select="RailRoadCar"/></xsl:element>

        <xsl:for-each select="//s0:HLLoop1[s0:HL/HL03='I' and s0:MAN/MAN02=$ItemID]">
            <xsl:variable name="HLPack" select="s0:HL/HL02"/>
            <xsl:element name="PackLoop">

                <xsl:elemment name="PackID">
                    <xsl:value-of select="//s0:HLLoop1[s0:HL/HL01=$HLPack and s0:HL/HL03='P']/s0:MAN/MAN02"/>
                </xsl:elemment>

            </xsl:element>
        </xsl:for-each>

    </xsl:element>
</xsl:for-each>

I have also tried putting a namespace qualifier in the PackLoop element like so: , but this results in the same error. Can someone help with the syntax here?

Thanks, Nathan


Solution

  • Long answer

    X cannot be a child of the 'xsl:element' element

    Look carefully at the X and see if it makes sense for it to be a child of xsl:element.

    Short answer

    Change xsl:elemment to xsl:element.