XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Shailendra GodboleSubject: XML / XSL DOM Problem
Author: Shailendra Godbole
Date: 28 Dec 2005 03:50 PM
I have an XML file which is having escape charecters like & The Tag data is company name for eg. Hinderson & Co. when what it actually means is Hinderson & Co.

I have an XSL that processes this XML file. If I am viewing the data in explorer (IE 5-6) it shows me correctly. However if I load the XMl file and XSL file in 2 DOM objects and then use the transformNode method of DOM it gives me data with same & and more over it also adds and line break in between the data which when transformed results into 2 rows.

I tried things like
1. PrserveWhiteSpace=False
2. Some Escape="yes" header for XSL but invain

Can you help

Thanks
SG

Postnext
Minollo I.Subject: XML / XSL DOM Problem
Author: Minollo I.
Date: 28 Dec 2005 04:19 PM
Two different questions.

If you don't want to escape output, you'll neet to let the XSLT processor know:
<xsl:value-of select="something" disable-output-escaping="yes"/>

About whitespaces/newlines in the XSLT output to the result: XSLT processors will ignore any ignorable whitespace.
So, something like...
<xsl:value-of .../>

<xsl:value-of .../>
...will not output any newline, because the whitespace between the two instructions can be ignored. On the other hand, if you do:
<xsl:value-of .../>,

<xsl:value-of .../>
...will output a comma followed by two newlines, because the whitespaces cannot be ignored. If you don't want to do...
<xsl:value-of .../>,<xsl:value-of .../>
...you could do...
<xsl:value-of .../>
<xsl:text>,<xsl:text/>
<xsl:value-of .../>

In neither case you'll have a newline output to the result.

As a suggestion for the future, a good place for general XSLT-specific questions is the xsl-list at http://www.mulberrytech.com/xsl/xsl-list/index.html

Hope this helps,
Minollo

Postnext
Shailendra GodboleSubject: XML / XSL DOM Problem
Author: Shailendra Godbole
Date: 28 Dec 2005 04:51 PM
Nope it still have same problem.
Let me give an example

<!-- The base XML -->

<LEVEL1>
<LEVEL2>
<LEVEL3>
<CName>Hinderson (5013)
&amp; Co. #1 abcd</CName>
</LEVEL3>
<LEVEL3>
.....
</LEVEL2>
</LEVEL1>

My XSL is
<xsl:strip-space elements="*"/>
<xsl:template match="/">
CNAME<BR/>
<xsl:for-each select="/LEVEL1/LEVEL2/LEVEL3">
<xsl:value-of select="CName" disable-output-escaping="yes"/><BR/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Posttop
Minollo I.Subject: XML / XSL DOM Problem
Author: Minollo I.
Date: 28 Dec 2005 05:16 PM
If I run it in Stylus Studio (using any processor) I see the "&" returned unescaped; in your case you might be seeing it escaped as a side effect of the way you are retrieving the result?

Minollo

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.