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: 

transformation

SG141
Active Participant
0 Kudos
133

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

Sandra_Rossi
Active Contributor
0 Kudos
44

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>