Jump to content

XSLT For Each Not Carrying Attribute To Target


bjr149

Recommended Posts

I am mapping from the same variable to itself trying to figure out why the attributes won't carry over.

 

 

Source XML

<ns1:Data-Structure  Name="Interchange"><ns1:Lookup  Name="InterchangeSenderID">95000</ns1:Lookup><ns1:Property  Name="InterchangeSenderID">95000</ns1:Property><ns1:Data-Structure  Name="Group"><ns1:Lookup  Name="GroupSenderID">195000</ns1:Lookup></ns1:Data-Structure></ns1:Data-Structure>

Target XML After XSLT

<ns1:Data-Structure  ns1:Name=""><ns1:Lookup  ns1:Name="">95000</ns1:Lookup><ns1:Property  ns1:Name="">95000</ns1:Property><ns1:Data-Structure  ns1:Name=""><ns1:Lookup>195000</ns1:Lookup></ns1:Data-Structure></ns1:Data-Structure>

The attributes won't be copied. here is the XSLT can you see what the issue is?

    <ns1:Data-Structure>            <xsl:attribute name="ns1:Name">              <xsl:value-of select="/ns1:Canonical850/ns1:Internal-Properties/ns1:Data-Structure/@ns1:Name"/>            </xsl:attribute>            <ns1:Lookup>              <xsl:attribute name="ns1:Name">                <xsl:value-of select="/ns1:Canonical850/ns1:Internal-Properties/ns1:Data-Structure/ns1:Lookup/@ns1:Name"/>              </xsl:attribute>              <xsl:value-of select="/ns1:Canonical850/ns1:Internal-Properties/ns1:Data-Structure/ns1:Lookup"/>            </ns1:Lookup>            <ns1:Property>              <xsl:attribute name="ns1:Name">                <xsl:value-of select="/ns1:Canonical850/ns1:Internal-Properties/ns1:Data-Structure/ns1:Property/@ns1:Name"/>              </xsl:attribute>              <xsl:value-of select="/ns1:Canonical850/ns1:Internal-Properties/ns1:Data-Structure/ns1:Property"/>            </ns1:Property>            <ns1:Data-Structure>              <xsl:attribute name="ns1:Name">                <xsl:value-of select="/ns1:Canonical850/ns1:Internal-Properties/ns1:Data-Structure/ns1:Data-Structure/@ns1:Name"/>              </xsl:attribute>              <ns1:Lookup>                <xsl:if test="/ns1:Canonical850/ns1:Internal-Properties/ns1:Data-Structure/ns1:Data-Structure/ns1:Lookup/@ns1:Name">                  <xsl:attribute name="ns1:Name">                    <xsl:value-of select="/ns1:Canonical850/ns1:Internal-Properties/ns1:Data-Structure/ns1:Data-Structure/ns1:Lookup/@ns1:Name"/>                  </xsl:attribute>                </xsl:if>                <xsl:value-of select="/ns1:Canonical850/ns1:Internal-Properties/ns1:Data-Structure/ns1:Data-Structure/ns1:Lookup"/>              </ns1:Lookup>              <ns1:Property>                <xsl:attribute name="ns1:Name">                  <xsl:value-of select="/ns1:Canonical850/ns1:Internal-Properties/ns1:Data-Structure/ns1:Data-Structure/ns1:Property/@ns1:Name"/>                </xsl:attribute>                <xsl:value-of select="/ns1:Canonical850/ns1:Internal-Properties/ns1:Data-Structure/ns1:Data-Structure/ns1:Property"/>              </ns1:Property>            </ns1:Data-Structure>          </ns1:Data-Structure>
Edited by bjr149
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...