Application Development and Automation 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: 
Read only

transformation

SG141
Active Participant
0 Likes
593

I am trying the following code...



<xsl:template match="test">
<p>
This is 
       <xsl:value-of select="test-Name"/>
from 
<xsl:value-of select="test-city"/>
      </p>
    </html>
  </xsl:template>
</xsl:transform>

I am expecting the output to be...

This is XYZ (Value in Name) from TEXAS ( value in city)..

however i am getting ...

This is from.

Let me know how to fix the issue?

I am trying the following code...



<xsl:template match="test">
<p>
This is 
       <xsl:value-of select="test-Name"/>
from 
<xsl:value-of select="test-city"/>
      </p>
    </html>
  </xsl:template>
</xsl:transform>

I am expecting the output to be...

This is XYZ (Value in Name) from TEXAS ( value in city)..

however i am getting ...

This is from.

Let me know how to fix the issue?

1 REPLY 1
Read only

Sandra_Rossi
Active Contributor
0 Likes
504

You didn't give us neither the source, nor the target, nor how you run the transformation. So I did a test like that, and it works:

ABAP:


DATA l_xml TYPE string.
DATA l_xml2 TYPE string.
l_xml = '<?xml version="1.0" encoding="iso-8859-1"?><test>'
& '<test-Name>Sandra</test-Name><test-city>Paris</test-city></test>'.
CALL TRANSFORMATION zzysro
    SOURCE XML l_xml
    RESULT XML l_xml2.
write / l_xml2.

Transformation:


<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
  <xsl:strip-space elements="*"/>
  <xsl:template match="test"><p>This is <xsl:value-of select="test-Name"/> from
<xsl:value-of select="test-city"/></p></xsl:template>
</xsl:transform>

Displayed Result:


<?xml version="1.0" encoding="iso-8859-1"?>#<p>This is Sandra from Paris</p>