on 2005 Nov 17 11:04 AM
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>
</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
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>
</xsl:text>
</xsl:variable>
Try this one
<xsl:variable name="newline" select="' '"/>
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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>
</xsl:text>
</xsl:variable>
is OK for XSL. The reason for the problem is the wrong use of '
'.
I tried to use ' ' to replace the '
', then I got the expected result. Great!
Below is the right lines now I use:
<xsl:variable name="newline"> <xsl:text> </xsl:text>
</xsl:variable>
Although I have solved the problem, I wonder why I can't use 
 to present the Carriage Return. In fact, '
' works well in JAVA.
User | Count |
---|---|
69 | |
11 | |
10 | |
10 | |
9 | |
9 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.