Re: [xsl] Transformation problems with CR-LF

Subject: Re: [xsl] Transformation problems with CR-LF
From: "Vishwajit Pantvaidya" <pantvaidya@xxxxxxxxxxx>
Date: Wed, 30 Apr 2003 13:04:06 -0700
Thanks Joe for your reply. I had been testing related to this issue some time back but could not reply immediately.

The source xml string that I was trying to transform was of the type (exactly as is, including newlines)

<!DOCTYPE ABC [
...
]><ABC>
...
<attr>
value</attr>

In other words, the nature of placement of newline was probably resulting in it getting included in the value of the element (e.g attr above). Would such newlines yield the empty output xml I was getting? I tried using xsl-strip space but that did not help. Finally, I had to write get the newlines removed from the source xml and then I started getting output xml correctly. To verify that those newlines were the cause of the problem, I also did some backtracking from a working source xml string. I did find that the moment I put newlines at these positions (within an element value), I started getting empty output.

Our xsl is like

<?xml version = "1.0" encoding = "UTF-8"?>
<xsl:transform xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"; version = "1.0">
<xsl:template match = "ABC">
<xsl:text disable-output-escaping="yes">&lt;!DOCTYPE OrderProcessing&gt;</xsl:text>
...
<xsl:template mode = "Attribs" match = "ctrInfo">
<xsl:element name="ADDR">
<xsl:value-of select="attribute/atomicValue[../name='ADDR']"/>
</xsl:element>
...



Any suggestions?



- Vishwajit.





From: Joseph Kesselman <keshlam@xxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Transformation problems with CR-LF
Date: Wed, 19 Feb 2003 11:31:10 -0500

>I am using xalan for xml to xml transformation. Input xml string has some

>DOS carriage return and/or line feeds introduced by the source
application,

Xalan -- and any other compliant XML processor -- will normalize line
breaks of any sort to an XML "newline" before processing them. An XSLT
stylesheet will process newline as text, unless you explicitly tell it
otherwise. There's some good advice in Michael Kay's book on how to
suppress undesired whitespace; I presume the FAQs for this list have
equivalent advice...

______________________________________
Joe Kesselman  / IBM Research


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread