Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT standard copy template losing attributes

Former Member
0 Kudos

Hi,

I am trying to perform what I have read is the simplest XSLT task possible.

The task is to copy all XML to an output document while suppressing certain tags under certain conditions.

What I have noticed is that the attributes of my nodes are being lost.

For example, within my XML output I have a tag <InstdAmt Ccy='EUR'>1000</InstdAmt>.

Once the template below has been applied all tags are copied but the "Ccy" attribute is lost.

Could anyone provide some insight into what I am doing wrong...

<xsl:stylesheet

  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  version="1.0">

  <xsl:output omit-xml-declaration="no" indent="yes"/>

  <xsl:strip-space elements="*"/>

  <xsl:template match="node()|@*">

    <xsl:copy>

      <xsl:apply-templates select="node()|@*"/>

    </xsl:copy>

  </xsl:template>

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Have found the solution to this.

The issue lies in the difference between deep and shallow copy in XSLT.

Have begun using deep copy and am getting desired results.

1 REPLY 1

Former Member
0 Kudos

Have found the solution to this.

The issue lies in the difference between deep and shallow copy in XSLT.

Have begun using deep copy and am getting desired results.