cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT problem with Carriage return in Web Dynpro

former_member336373
Participant
0 Kudos

My problem is:

In java application, I can tranform the xml file into another format with a certain stylesheet(XSL file) properly. But when I use the same code and the same XSL file to do the transformation in Web Dynpro, it outputs the wrong result, in which all the <b>Carriage Return disappears</b>.

Here is the example:

-Input file (source.xml)-

<?xml version="1.0"?>

<?xml-stylesheet type='text/xsl'>

<List>

<Name age="20">Sandy</Name>

<Name age="23">Sue</Name>

<Name age="18">Billy</Name>

</List>

-XSL file-

<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="text"/>

<xsl:variable name="newline">

<xsl:text>&#xA;</xsl:text>

</xsl:variable>

<xsl:variable name="space">

<xsl:text> </xsl:text>

</xsl:variable>

<xsl:template match="/">

<xsl:for-each select="List/Name">

<xsl:value-of select="."/>

<xsl:value-of select="$space"/>

<xsl:value-of select="@age"/>

<xsl:value-of select="$newline"/>

</xsl:for-each>

</xsl:template>

</xsl:stylesheet>

In java app:

-Output file (DesJava.txt)->(Right result)

Sandy 20

Sue 23

Billy 18

In Web Dynpro:

-Output file (DesWebDynpro.txt)->(Wrong result)

Sandy 20Sue 23Billy 18

All above shows, in Web Dynpro the Carriage Return symbol is dismissed.

Anybody know the reason and the solution to solve this problem?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hello Irene,

Are you using Dynpro to create file containing results of transformation or you are using some UI elements to display such results?

BTW, why are you using

	<xsl:variable name="newline">
		<xsl:text>&#xA;</xsl:text>
	</xsl:variable>

Try this one


<xsl:variable name="newline" select="'&#13;&#10;'"/>

Best regards, Maksim Rashchynski.

former_member336373
Participant
0 Kudos

Hi,Maksim

I just use Dynpro to create transformation result.

Finally I solved the problem under your tips.

Here, the format

<xsl:variable name="newline"> <xsl:text>&#xA;</xsl:text>

</xsl:variable>

is OK for XSL. The reason for the problem is the wrong use of '&#Xa;'.

I tried to use '&#13;&#10;' to replace the '&#Xa;', then I got the expected result. Great!

Below is the right lines now I use:

<xsl:variable name="newline"> <xsl:text>&#13;&#10;</xsl:text>

</xsl:variable>

Although I have solved the problem, I wonder why I can't use &#xa; to present the Carriage Return. In fact, '&#xa;' works well in JAVA.

former_member182372
Active Contributor
0 Kudos

Hello Irene,

If the problem is solved, please assign points "Solved problem" and close thread.

Best regards, Maksim Rashchynski.

former_member318735
Participant
0 Kudos

Hi,

How did you parse xml document via dynpro application. Could you please tell me more about steps.

Answers (0)