Re: uses for strSplit-to-Words2 was RE: Re: How to pro
"Bryan Rasmussen" <bry at itnisk dot com> wrote: > Dimitre wrote: > >Use strSplit-to-Words2.xsl from the FXSL xslt functional programming > >library. > > I was just thinking that strSplit might enable something I've thought > of before but could never quite get my head around, which we might > call double-splitting, that is to say having a list of values that > are split in two(or more ways), example of css values should clarify > meaning. > <div style="background-color:buttonface;border-bottom:black 2px > solid;border-right:black 1px solid; font-family:verdana; > font-size:largest;"></div> > > I have sometimes come across scenarios where it would be useful to > split the values in @style into seperate elements for the property > names and values, have always had gut feeling that doing so in xslt > would hurt my brain, although I've written plenty of variations on > classic string splitting templates. > it seems that if one saved each split at the ; to a nodeset, then use > substring-before, substring-after on that nodeset at the : you could > do something like this, slight trepidation about processing power > used, although I don't think of this as online stuff, rather a > datamining thing. > > Am curious if others using the FXSL library find this a reasonable > suggestion. Line splitting is an example of "double splitting". Or you may pass to the tokeniser a user-supplied function, that given the current token performs its own, different tokenization on it. When this problem is generalised (e.g. the maximum nesting level cannot be known in advance), we'll definitely need something more powerful than regular expressions. Jeni has been asking for yacc-like functionality to be provided in XPath 2.0. Also DavidC gave an example from his work, which needed the power of a CFG parser and could not be dealt with using just regular expressions. It seems quite probable that such features will not be provided in future versions of XPath. Parser toolkits have been successfully developed in a functional programming language , , and it's possible to produce such tools in pure XSLT 1.0 with the help of a functional programming library. Cheers, Dimitre Novatchev. References: 1. Happy, The Parser Generator for Haskell http://www.haskell.org/happy/ 2. Fast, Error Repairing Parser Combinators http://www.cs.uu.nl/groups/ST/Software/UU_Parsing/ __________________________________________________ Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format