Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Problem with preserving the format of xml element during xslt

Reply
Thread Tools

Problem with preserving the format of xml element during xslt

 
 
longinus
Guest
Posts: n/a
 
      11-12-2004
Hello,

I have following element in XML:

<Elem><![CDATA[dsdfhdfh<BR/>dfshdfhdfh
dddd
dddd<BR/>dsfhfdh<BR/>]]></Elem>

which is preformatted and i would like to have the format on the
webpage(html) as well.

In XSL-file there is a following instructions:
<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform"
....>
<PRE>
<xsl:value-of select="Elem> diable-output-escaping="yes"/>
</PRE>

after XSLT preformatted text should preserve format on the webpage.

What i get is:

dsdfhdfh
dfshdfhdfh
dddd dddd
dsfhfdh

Where is the problem?

Thanks,
longinus
 
Reply With Quote
 
 
 
 
Anton Spaans
Guest
Posts: n/a
 
      11-12-2004

"longinus" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hello,
>
> I have following element in XML:
>
> <Elem><![CDATA[dsdfhdfh<BR/>dfshdfhdfh
> dddd
> dddd<BR/>dsfhfdh<BR/>]]></Elem>
>
> which is preformatted and i would like to have the format on the
> webpage(html) as well.
>
> In XSL-file there is a following instructions:
> <xsl:stylesheet version="1.0"
> xmlnssl="http://www.w3.org/1999/XSL/Transform"
> ...>
> <PRE>
> <xsl:value-of select="Elem> diable-output-escaping="yes"/>
> </PRE>
>
> after XSLT preformatted text should preserve format on the webpage.
>
> What i get is:
>
> dsdfhdfh
> dfshdfhdfh
> dddd dddd
> dsfhfdh
>
> Where is the problem?
>
> Thanks,
> longinus


(i assume that there are some typo's in your original post)

What do you want to see?
If you do 'view source' on the html you probably will see this:
========================
dsdfhdfh<BR/>dfshdfhdfh
dddd
dddd<BR/>dsfhfdh<BR/>
========================

But in html, inside the browser, this will be shown as
========================
dsdfhdfh
dfshdfhdfh
dddd dddd
dsfhfdh
========================

If you want to have this shown inside the browser:
========================
dsdfhdfh<BR/>dfshdfhdfh
dddd
dddd<BR/>dsfhfdh<BR/>

========================
then don't use <PRE>, but use an enclosing <XMP> element instead in your XSL
(or <TEXTAREA>)

-- Anton.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sign preserving Vs value preserving sophia.agnes@gmail.com C Programming 4 12-07-2007 03:14 PM
Problem to insert an XML-element by XSLT-converting from one XML-file into another XML-file jkflens XML 2 05-30-2006 09:41 AM
XSLT: preserving an element with all its attributes Martin Plantec XML 3 10-28-2005 03:35 PM
integral promotion, arithmetic conversion, value preserving, unsigned preserving??? TTroy C Programming 16 01-31-2005 10:20 PM
XSLT:Preserving HTML tags from original XML. Joe XML 2 09-21-2004 01:30 AM



Advertisments