xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Welch" <AWe...@piper-group.com>
Subject RE: Newline problems
Date Fri, 02 May 2003 08:07:38 GMT

Hi,

If your source data looks like this:

<attr>
value</attr>

then the newline is significant, and is part of a text node.  xsl:strip-space will remove
whitespace only text nodes, so in this case to remove the newline use either normalize-space()
or the translate() function.

cheers
andrew 

> -----Original Message-----
> From: Vishwajit Pantvaidya [mailto:pantvaidya@hotmail.com]
> Sent: 01 May 2003 19:04
> To: xsl-list@lists.mulberrytech.com; xalan-j-users@xml.apache.org
> Subject: Newline problems
> 
> 
> 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. The source xml string that I was trying to 
> transform is like 
> (exactly as is, including newlines)
> 
> <!DOCTYPE ABC [
> ...
> ]><ABC>
> ...
> <attr>
> value</attr>
> ...
> </ABC>
> 
> i.e. the newline was probably getting included in the value 
> of the element 
> "attr". Would such newlines yield the empty output xml I was getting? 
> Xsl-strip space did not help. Finally, I had to write java 
> code to strip the 
> newlines from the source xml and then I started getting output xml 
> correctly.
> 
> 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>
> 
> 
> Please help...
> 
> 
> - Vishwajit.
> 
> 
> 
> 
> 
> _________________________________________________________________
> STOP MORE SPAM with the new MSN 8 and get 2 months FREE*  
> http://join.msn.com/?page=features/junkmail
> 
> 
> 
> 
> 
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.470 / Virus Database: 268 - Release Date: 08/04/2003
>  
> 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.470 / Virus Database: 268 - Release Date: 08/04/2003
 

Mime
View raw message