|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Truncated text string, relative to child node
> I have an XML file like this: > > <a> lorem ipsum text ... lorem ipsum <b> dolor </b> lorem ipsum ... > lorem ipsum </a> > > I want to create a string of the five words from <a> right > before the <b> tag, and a string of the five words > immediately after <b>. All I can do is create strings from > the beginning or the end of the <a> tag, but basically I want > the text in the middle, relative to the child <b> node. In 2.0, assuming the <a> element is the context node, the two sequences are given by subsequence(tokenize(b/following-sibling::text(), '\s'), 1, 5) and reverse(subsequence(reverse(tokenize(b/preceding-sibling::text(), '\s')), 1, 5)) In 1.0, you'll have to be prepared for something rather more verbose. Michael Kay http://www.saxonica.com/
|
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
|






