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

RE: getting the text nodes from a set of attribute nod

Subject: RE: getting the text nodes from a set of attribute nodes
From: "Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx>
Date: Thu, 4 Sep 2003 14:53:41 -0400 (EDT)
RE:  getting the text nodes from a set of attribute nod
On Thu, 4 Sep 2003, Michael Kay wrote:

> >   <a>
> >    <b attr="w1 w3 w6">...</b>
> >    <b attr="w2 w12 w3 w7">...</b>
> >    ... more <b>s here ...
> >   </a>
> > 
> > when processing an <a> element, i need to calculate the 
> > maximum number of whitespace-separated words for any 
> > "b/@attr" attribute. so just what you see above, the value 
> > would be 4, based on that second <b> child of <a>.
> > 
> > AFAICT, this will involve three steps:
> > 
> > 1) collect the "b/@attr" attributes (easy)
> > 2) normalize space and word count each of those attribute values
> >    (again, easy, stealing from kay, p. 527, the "word-count"
> >    template :-)
> > 3) finding the maximum of those values
> 
> You can count the words without recursive processing:
> 
> $x := normalize-space(@attr)
> $y := translate(@attr, ' ', '')
> $wc := string-length($x) - string-length($y) +1

ok, thanks.  that makes things easier.

> > since, as i understand it, you can't have a node-set of just 
> > numbers, 
> 
> Since numbers aren't nodes, how could you have a node-set containing
> numbers?

but that was my point.  the sample XSL i showed for calculating the 
minimum value was *treating* a node-set as if the individual elements
were numbers, and was comparing them numerically.

  <xsl:value-of select="$nodes[not($nodes &lt; .)]"/>

how would this be interpreted?  the book refers to this as calculating
"the minimum value of a node set", which to my mind is viewing the 
"nodes" as numerical values.  i wasn't trying to suggest that numbers
were actual nodes, only that they were being "treated" that way by
the above expression.

rday


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

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
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.