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

Re: [XSL] extracting a verse

Subject: Re: [XSL] extracting a verse
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 18 Dec 2002 18:21:43 -0500
free verses encouragement
Hi Michael,

At 05:21 PM 12/18/2002, you wrote:
Thanks for the encouragement. I can't really say that I will be able to spend any more time on this, but it seemed like there should be a relatively simple tale-recursive solution. (which is what the third template below name="nextsib") really is. The rest is just wrapping.

Heh -- you're not the first one to say this. (I said it myself when I started looking at this problem, two years ago or so. The last time I said it ... Jeni made fun of me. Not that I mind *that* attention, mind you.) "The rest is just wrapping", indeed. :->


A simpler example to chew on -- transform

<quote>
<verse/>No! penury, inertness and grimace,<endVerse/>
<verse/>In some strange sort, were the land's portion. <q>See<endVerse/>
<verse/>Or shut your eyes,</q> said Nature peevishly,<endVerse/>
<verse/><q>It nothing skills: I cannot help my case:<endVerse/>
<verse/>'Tis the Last Judgment's fire must cure this place,<endVerse/>
<verse/>Calcine its clods and set my prisoners free.</q><endVerse/>
</quote>
(from Rob't Browning, "Childe Roland to the Dark Tower Came", 61-66)

into

<quote>
<verse>No! penury, inertness and grimace,</verse>
<verse>In some strange sort, were the land's portion. <q>See</q></verse>
<verse><q>Or shut your eyes,</q> said Nature peevishly,</verse>
<verse><q>It nothing skills: I cannot help my case:</q></verse>
<verse><q>'Tis the Last Judgment's fire must cure this place,</q></verse>
<verse><q>Calcine its clods and set my prisoners free.</q></verse>
</quote>

When the second verse is processed, we have to include a <q> with the text node "See", but none of the <q> element's other text node children. Fine. But we also need the next verse to contain a new <q> element to wrap the text node "Or shut your eyes". Likewise in later lines, which contain an extended quote that has either to be split among three verses (and it would be nice if they pointed to one another), or inverted to contain them (as a poor alternative). The solution to this problem also has to be recursive, since again things could be arbitrarily deep (we might be deeper than a single <q> when a line breaks).

The lesson for now seems to be to narrow the problem, if possible, into something easier than the general case (that still achieves your goals), and go for that.

Mind you, I'm not saying the general solution isn't possible, especially given more than one pass (maybe a flattening pass followed by a rebuilding pass). This list has already sponsored more than its share of creative leaps.

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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.