Wrox Programmer Forums
|
BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0
This is the forum to discuss the Wrox book XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition by Michael Kay; ISBN: 9780470192740
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 7th, 2011, 02:59 AM
Registered User
 
Join Date: Mar 2011
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default WS processing in an example on page 69

Hello,

In the section called "Contents of a Template Rule" in chapter 2 on page 69, there is an example with an extract from a stylesheet containing an <html> element and after that the text "The end". My first guess at how Saxon HE 9.2 would deal with the text, is that the text node is formed by the whitespaces before "The end" (carriage return + spaces or tabulation), the text itself and then the whitespaces after "The end" (carriage return). Thus we have a text node consisting not only of WS but also having regular characters. As such the text node will not be deleted, regardless of WS processing settings.
Indeed in the text, it is written that "(..) and some text («The end», preceded and followed by significant whitespace)". I understand this WS is significant.

When I execute the transformation the result includes "The end" with a carriage return before and after it but no spaces (or tabulation) before the text. I don't understand why. I thought all the WS that is included in the text node goes into the result tree.

By the way, when I execute the transformation with version set to 1.0 and with Xalan (an XSLT 1.0 processor), the result includes the spaces before "The end".

I would appreciate any clarification on this matter.

Thank in advance,

Ludovic Kuty

Last edited by lkuty; March 7th, 2011 at 04:36 AM..
 
Old March 7th, 2011, 05:09 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Because the first thing output by this stylesheet is an html element, the serializer uses the html output method, which allows considerable flexibility in whitespace handling - it basically allows whitespace to be eliminated if the browser would treat it as insignificant. If you change the element name from html to xml you will see that the output changes.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
lkuty (March 7th, 2011)
 
Old March 7th, 2011, 05:24 AM
Registered User
 
Join Date: Mar 2011
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks for your quick answer.
I also tried by specifying an xml method with xsl:output and the output is as expected.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to INVOKE any WS on server by WS on client ? Abhinavnaresh ASP.NET 2.0 Professional 1 April 4th, 2008 01:09 PM
Need help with Macro for Go to in WS Wazar Excel VBA 3 December 31st, 2006 03:44 AM
Display page while processing echovue Classic ASP Professional 1 May 28th, 2006 09:30 AM
Exposing WS Properties r_ganesh76 .NET Web Services 2 October 3rd, 2004 11:08 PM
Chapter 2, pages 68/69 moviesite.php ruairiglenn04 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 August 1st, 2004 05:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.