[
Lists Home |
Date Index |
Thread Index
]
Thanks Ken.
This is very well worded. And I will leave it to our XSLT gurus to argue
about whether our XSLT 1.0 implementation is non-conformant or only
wrong :-).
Best regards
Michael
> -----Original Message-----
> From: G. Ken Holman [mailto:gkholman@CraneSoftwrights.com]
> Sent: Friday, July 25, 2003 12:38 PM
> To: xml-dev@lists.xml.org
> Subject: RE: [xml-dev] Xpath Question
>
> At 2003-07-25 11:47 -0700, Michael Rys wrote:
> >Sorry but this is FUD.
>
> I apologize, but this was never my intention, and I'll thank you to
not
> make the assumption that it is.
>
> >XPath 1.0 has no conformance requirement on what data model a parser
> >needs to generate.
>
> Then I will amend my statement to say "In the context of XSLT the data
> model created from XPath states the number of nodes is 5".
>
> >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.
>
> Fine ... but given your use of "can" and Dare's lack of a
specification of
> the context in which XPath is being used, I think it is unfair to
claim my
> statement to be FUD.
>
> Let me try again:
>
> > > 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?
>
> In the context of XSLT 1.0 where this instance is being treated as a
> source
> file to build a source node tree and the stylesheet does not include
any
> <xsl:strip-space> or <xsl:preserve-space> instructions, section 3 of
> http://www.w3.org/TR/1999/REC-xslt-19991116 states "The data model
used by
> XSLT is the same as that used by XPath with the additions described in
> this
> section" and the applicable statements from section 3.4 of
> http://www.w3.org/TR/1999/REC-xslt-19991116 indicate all text nodes
are
> preserved because:
>
> (a) - the element name of the parent of the text node is in the set
of
> whitespace-preserving element names
> (b) - for source documents, the set of whitespace-preserving
element
> names is specified by xsl:strip-space and xsl:preserve-space top-level
> elements
> (c) - initially, the set of whitespace-preserving element names
> contains
> all element names
>
> So, given that context that I've just assumed (an environment claiming
to
> be conformant to XSLT 1.0), I stand by the rest of my posting, and it
is
> *not* meant to malign IE or Microsoft or spread FUD ... I'm only
reporting
> it as I see it and understand it. I *thought* Microsoft claimed the
IE
> implementation of XSLT to follow XSLT 1.0 (though I cannot find such a
> claim right now in the product pages) ... certainly my students think
it
> is
> ... but because of the difference I cite below (and by chapter and
verse
> of
> XSLT 1.0 cited above) I don't use IE in my teaching of XSLT.
>
> And most (all?) students of mine who are using the Microsoft XPath
> implementation are using it in the context of XSLT 1.0.
>
> Regarding conformance, chapter 17 of
> http://www.w3.org/TR/1999/REC-xslt-19991116 states "A conforming XSLT
> processor must be able to use a stylesheet to transform a source tree
into
> a result tree as specified in this document." ... which I believe ties
in
> all of the statements I cited above from section 3.
>
> If there is ambiguity regarding Dare's question of XPath in the
context of
> XSLT, then I don't know where it is.
>
> I *sincerely* hope this helps.
>
> .................. Ken
>
> > > 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@CraneSoftwrights.com
> 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>
|