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

RE: Xpath Question

  • To: "G. Ken Holman" <gkholman@C...>,<xml-dev@l...>
  • Subject: RE: Xpath Question
  • From: "Michael Rys" <mrys@m...>
  • Date: Fri, 25 Jul 2003 11:47:16 -0700
  • Thread-index: AcNS1ztt2PHl+6T4SyapzNpcaA2tiwABF6Dw
  • Thread-topic: Xpath Question

xml pre
Sorry but this is FUD.

XPath 1.0 has no conformance requirement on what data model a parser
needs to generate.

Unless you have an explicit xml:space="preserve" set, the generation of
the datamodel as a consumer of the output of the XML parser (which
always preserves all the whitespace) can drop the boundary whitespace
text nodes.

Best regards
Michael

> -----Original Message-----
> From: G. Ken Holman [mailto:gkholman@C...]
> Sent: Friday, July 25, 2003 10:54 AM
> To: xml-dev@l...
> Subject: Re:  Xpath Question
> 
> At 2003-07-25 10:42 -0700, Dare Obasanjo wrote:
> >One of our devs just made me question all that's right in the world
with
> >the question below. Given the following XML
> >
> ><pre>
> >   <b>bold</b>
> >   <i>italic</i>
> ></pre>
> >
> >what is the result of the following XPath expression
> >"count(/pre/child::node())" ?
> >
> >Is the answer 2 or 5?
> 
> XPath says it is 5 because of the text nodes.  See[1] the Saxon report
> below.
> 
> A DTD might say the intervening white-space is ignorable, but XPath
> doesn't
> preserve the concept of ignorable white-space.  All white-space in
XPath
> is
> significant, hence burdening a stylesheet writer with indicating which
> elements have ignorable white-space using <xsl:strip-space>.
> 
> A big problem teaching XSLT to users of Microsoft products is that IE
> engages MSXML throwing away *all* whitespace, which doesn't conform to
> XPath 1.0.  See[2] the IE6 report below.
> 
> I hope this helps.
> 
> .................... Ken
> 
> 
> [1] Using Saxon:
> 
> T:\ftemp>type dare.xml
> <pre>
>    <b>bold</b>
>    <i>italic</i>
> </pre>
> 
> T:\ftemp>showtree dare.xml
> 
> T:\ftemp>type dare.xml.shw
> SHOWTREE Stylesheet - http://www.CraneSoftwrights.com/resources/
> Processor: SAXON 6.5.2 from Michael Kay
> 1  Element 'pre':
> 1.I  Namespace 'xml': {http://www.w3.org/XML/1998/namespace}
> 1.1  Text (pre): {
>    }
> 1.2  Element 'b' (pre):
> 1.2.I  Namespace 'xml': {http://www.w3.org/XML/1998/namespace}
> 1.2.1  Text (pre,b): {bold}
> 1.3  Text (pre): {
>    }
> 1.4  Element 'i' (pre):
> 1.4.I  Namespace 'xml': {http://www.w3.org/XML/1998/namespace}
> 1.4.1  Text (pre,i): {italic}
> 1.5  Text (pre): {
> }
> T:\ftemp>
> 
> [2] Using MSXML through IE6 and copying the screen contents to the
> clipboard:
> 
> T:\ftemp>type dare-ms.xml
> <?xml-stylesheet href="showtree.msxsl" type="text/xsl"?>
> <pre>
>    <b>bold</b>
>    <i>italic</i>
> </pre>
> 
> T:\ftemp>copy con nul
> SHOWTREE Stylesheet
> file:///T:/ftemp/dare-ms.xml
> http://www.CraneSoftwrights.com/resources/
> 
> Root:
> 1 Proc. Inst. 'xml-stylesheet' (): {href="showtree.msxsl"
type="text/xsl"}
> 2 Element 'pre' ():
> 2.1 Element 'b' (pre):
> 2.1.1 Text (pre,b): {bold}
> 2.2 Element 'i' (pre):
> 2.2.1 Text (pre,i): {italic}
> 
> ^Z
>          1 file(s) copied.
> 
> T:\ftemp>
> 
> 
> --
> Upcoming hands-on courses: in-house corporate training available;
> North America public:  XSL-FO Aug 4,2003; XSLT/XPath Aug 12, 2003
> 
> G. Ken Holman                mailto:gkholman@C...
> Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/x/
> Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999 (F:-0995)
> ISBN 0-13-065196-6                      Definitive XSLT and XPath
> ISBN 0-13-140374-5                              Definitive XSL-FO
> ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
> ISBN 1-894049-11-X              Practical Formatting Using XSL-FO
> Member of the XML Guild of Practitioners:    http://XMLGuild.info
> Male Breast Cancer Awareness http://www.CraneSoftwrights.com/x/bc
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.