[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xml:preserve space makes xsl:attribute fail in IE6

Subject: RE: xml:preserve space makes xsl:attribute fail in IE6
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 12 Dec 2002 10:10:07 -0000
xml preserve spaces
> For my xsl stylesheet, using
> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
> version="1.0" xml:space="preserve"> in IE6, I had a problem.
> 
> I found that when using the xsl:attribute construct like this, no 
> attributes were added to my anchor tag (by checking the HTML source)
> 
>          <a>
>          <xsl:attribute name="href">
>                  <xsl:value-of select="@start"/>
>          </xsl:attribute>
>          <xsl:value-of select="title"/>
>          </a>
>

Because you have said that whitespace is significant, the spaces between
the <a> and the <xsl:attribute> are treated as a text node to be added
as a child of the <a> element in the result tree. It's an error to try
to add an attribute to an element after adding a text node.
Implementations are allowed to either report the error, or ignore the
offending attribute node. It seems MSXML is doing the latter.

Using xml:space="preserve" in a stylesheet is not something I recommend,
unless the relevant section of the stylesheet is pure data that you want
to copy to the result tree.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx  
 
> I used the space="preserve" to keep my HTML tidy and 
> readable. Finally 
> after trying a number of otherwise working examples, I removed 
> space="preserve" from the stylesheet tag and presto, the 
> attribute was 
> added as expected.
> 
> I am transforming the XML source in javascript, setting up an 
> XML object 
> with MSXML2.DOMDocument ...
> 
> Questions : is there a known problem with preserve space on IE6 ?
> 
> Would this occur if I were to transform the XML server side (is it a 
> javascript problem) ?
> 
> Is there any other way to keep the HTML output formatting as 
> indented in 
> the stylesheet ?
> 
> Thanks for any feedback.
> Regards,
> Neil Smith.
> 
> 
> 
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.