Aromanin
Aromanin

Reputation: 33

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

Upvotes: 0

Views: 1888

Answers (2)

kjhughes
kjhughes

Reputation: 111591

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.

Upvotes: 2

felixmondelo
felixmondelo

Reputation: 1474

Why you don't use directly the names of the elements?

<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"/>
    <s0:ItemLoop>
        <ItemID><xsl:value-of select="$ItemID"/></ItemID>
        <OrderNum><xsl:value-of select="OrderNum"/></OrderNum>
        <RailRoadCar><xsl:value-of select="RailRoadCar"/></RailRoadCar>

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

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

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

    </s0:ItemLoop>
</xsl:for-each>

Upvotes: 1

Related Questions