![]() |
Telelogic System Architect (steve huntington) | ![]() |
Topic Title: Invalid XML from Report Generator Topic Summary: Is there an option I can set to generate valid XML? Created On: 22-Mar-2007 19:38 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
When I use the Report Generator (selecting HTML and Raw data) the resulting SAPrpValue attribute in the intermediate XML contains the x0A x0D character strings for carriage return and line feed. This isn't valid XML and when picked up by an XSLT transformation tool it transforms these into spaces. This destroys the formatting of the text for descriptions - so I was wondering if anyone knows of a patch or a configuration option that can be set so that the carriage return and line feed character stream is converted to something that is valid XML such as & #xA;
We're at SA version 10.4 Thanks. Steve Ireland Edited: 23-Mar-2007 at 15:30 by Steve Ireland |
|
![]() |
|
![]() |
|
These ARE valid XML characters - from the XML specification:
2.2 Characters [Definition: A parsed entity contains text, a sequence of characters, which may represent markup or character data.] [Definition: A character is an atomic unit of text as specified by ISO/IEC 10646:2000 [ISO/IEC 10646]. Legal characters are tab, carriage return, line feed, and the legal characters of Unicode and ISO/IEC 10646. The versions of these standards cited in A.1 Normative References were current at the time this document was prepared. New characters may be added to these standards by amendments or new editions. Consequently, XML processors MUST accept any character in the range specified for Char. ] Character Range [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */ Edited: 24-Mar-2007 at 20:13 by John Crouchley |
|
![]() |
|
![]() |
|
My guess is that your XSLT is generating HTML - the characters x0A and x0D in HTML are interpreted as white space and so appear as spaces.
We use a template such as the following to deal with this. <xsl:template name="lf2br"> <!-- import $StringToTransform --> <xsl <xsl:choose> <!-- string contains linefeed --> <xsl:when test="contains($StringToTransform,' ')"> <!-- output substring that comes before the first linefeed --> <!-- note: use of substring-before() function means --> <!-- $StringToTransform will be treated as a string, --> <!-- even if it is a node-set or result tree fragment. --> <!-- So hopefully $StringToTransform is really a string! --> <xsl:value-of select="substring-before($StringToTransform,' ')"/> <xsl:text disable-output-escaping="yes"><br/></xsl:text><!-- DEV_STRING --> <!-- repeat for the remainder of the original string --> <xsl:call-template name="lf2br"> <xsl:with-param name="StringToTransform"> <xsl:value-of select="substring-after($StringToTransform,' ')"/> </xsl:with-param> </xsl:call-template> </xsl:when> <!-- string does not contain newline, so just output it --> <xsl <xsl:value-of select="$StringToTransform"/> </xsl </xsl:choose> </xsl:template> Edited: 24-Mar-2007 at 20:18 by John Crouchley |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.