This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21671 - [FO30] analyze-string examples
Summary: [FO30] analyze-string examples
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows XP
: P2 trivial
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-11 22:36 UTC by Andrew Eisenberg
Modified: 2013-06-17 16:48 UTC (History)
0 users

See Also:


Attachments

Description Andrew Eisenberg 2013-04-11 22:36:26 UTC
The examples in section 5.6.5 fn:analyze-string start with:

"The expression fn:analyze-string("The cat sat on the mat.", "\w+") returns <analyze-string-result xmlns="http://www.w3.org/2005/xpath-functions"> <match>The</match> <non-match> </non-match> <match>cat</match> <non-match> </non-match> <match>sat</match> <non-match> </non-match> <match>on</match> <non-match> </non-match> <match>the</match> <non-match> </non-match> <match>mat</match> <non-match>.</non-match> </analyze-string-result>."

Not very readable. I suggest that you add:

Indented for readability, this result is:

<analyze-string-result xmlns="http://www.w3.org/2005/xpath-functions">
   <match>The</match>
   <non-match> </non-match>
   <match>cat</match>
   <non-match> </non-match>
   <match>sat</match>
   <non-match> </non-match>
   <match>on</match>
   <non-match> </non-match>
   <match>the</match>
   <non-match> </non-match>
   <match>mat</match>
   <non-match>.</non-match>
</analyze-string-result>
Comment 1 Michael Kay 2013-04-12 06:58:16 UTC
Probably makes sense. I was compromising here between the need for human readability and the desire to have as many of the examples as possible be automatically testable, since experience shows that examples that are not machine-testable are often wrong.
Comment 2 Michael Kay 2013-06-17 16:48:29 UTC
I have added an attribute fos:result normalize-space=true" to the function catalog schema to identify example results that need to be formatted with whitespace; I have added the relevant logic to the stylesheet; and I have used this mechanism to format these examples.