Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: XSL and Whitespace >Thread Next - Re: XSL and Whitespace Re: XSL and WhitespaceTo: NULL Date: 11/1/2004 10:54:00 AM Hi, > Hi, > > Setting the output method to 'text' may solves the ampersand and the superfluous wittespaces, but the 'a' element and it's attribute will not be outputted. (http://www.w3.org/TR/xslt.html#section-Text-Output-Method) > I don't think it makes sense to output 'text' if you're actually dealing with 'html'. Moreover you'd have to have to strinyfy all element and attributes throughout the stylesheet, a really bad idea if you ask me. > If this 'hack' really is the only way around it, don't you agree that this is a shortcomming in the XSLT1.0 Recommendation? I did not mention the output method at all! - merely pointed to the correct and safe way of outputting text nodes using the <xsl:text> instruction. This is no hack whatsoever, and there is not shortcomming in the W3 rec regarding this issue. It is known by all seasoned XSLT programmers that the first step towards taking firm control of whitespace (in whatever output mode) is to avoid using implicit text node output and opt for using explicit text node output using the <xsl:text> instruction. The <xsl:text> instruction is there for a reason - one of which being so that explicit output text nodes can be differentiated from whitespace text nodes in the stylesheet that are merely there to 'prettify' the stylesheet for readability (which might otherwise be assumed by the XSLT transformation as text nodes for output). I can only suggest you re-read my original posting again ;) If you read it carefully you will notice there is no mention of the output mode and gives clear example code on using the <xsl:text> instruction. Cheers Marrow "Joris Gillis" <roac@p...> wrote in message news:opsgr3mvnfyf9v9r@n...... > > The reason you are seeing whitespace in the attribute output is because you > > are using implied output text. As soon as you use implied output text - > > that implied output text will also include any whitespace (inc. tabs, CRs > > etc.). > > > > You can overcome this by using explicit output text (and it's best to get > > into the habit of using explicit output text), e.g. > > The ampersands are being correctly recognised and are being URL encoded > > according to the HTML/XHTML specs. > > Hi, > > Setting the output method to 'text' may solves the ampersand and the superfluous wittespaces, but the 'a' element and it's attribute will not be outputted. (http://www.w3.org/TR/xslt.html#section-Text-Output-Method) > I don't think it makes sense to output 'text' if you're actually dealing with 'html'. Moreover you'd have to have to strinyfy all element and attributes throughout the stylesheet, a really bad idea if you ask me. > If this 'hack' really is the only way around it, don't you agree that this is a shortcomming in the XSLT1.0 Recommendation? > > regards, > -- > Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041) > Ceterum censeo XML omnibus esse utendum | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
