Subject: RE: (data..), (attribute-string...), (node-property...) From: "John Sidlo" <jsidlo@xxxxxxxxxxxxxxxxxx> Date: Thu, 20 Aug 1998 15:43:17 -0400 |
A-Hahh! Many thanks to Brandon Ibach for the following solution, and accompanying lucid explanation which significantly improved my understanding of dsssl. If you understand why, given the nodelist nl for the structure <title>1234<footnote>x</footnote>5</title> the (node-list-length nl) is 6, and not 1 or 5, then you probably don't need to bother reading Brandon's explanation. Otherwise, have a look! ps - Daniel Speck also provided the correct solution - thanks to all who responded > -----Original Message----- > From: owner-dssslist@xxxxxxxxxxxxxxxx > [mailto:owner-dssslist@xxxxxxxxxxxxxxxx]On Behalf Of Brandon Ibach > Sent: Thursday, August 20, 1998 2:19 PM > To: dssslist@xxxxxxxxxxxxxxxx > Subject: Re: (data..), (attribute-string...), (node-property...) > > > John Sidlo said: ... > > > >In Jade I am trying to extract the data from a nodelist representing: > > > > > > ><title>foo<footnote>bar</footnote>more foo</title> > > > > > > >The dsssl expression (data nl) returns (correctly) "foobarmore foo"; > > > >I want to extract "foomore foo". I've tried > (attribute-string "data" nl) > > > >and (node-property 'data nl), but the property "data" > doesn't seem to be > > > >defined. > > > > > > >Can someone suggest a way to remove the children from <title>, > > > >or otherwise extract this? > > > > Here's a fairly simple method. First, the concept... The > following, when grovified, will produce nodes of two classes: > > <title>foo<footnote>bar</footnote>more foo</title> > ^------*** ********-------^ > ^---------***----------^ > > The ^--...--^'s are element nodes, with ... representing the > children of the node. Each * is a data-char node. These are what > you're interested in, but only the ones in the first row, which are > the data-char nodes that are direct children of the "title" element > node. > So, in processing the title node, you'll want to generate a > nodelist of title's children via a (children) call, then pass that to > a function which will filter out any non-data-char nodes. Fortunately, > the DSSSL standard includes such a function, and Jade implements it. > The following accepts a node (singleton node list, to be > technical) of type "element", and returns a string consisting of the > plain text which is the immediate content (ie, not within any children > elements) of that node. > > (define element-data (lambda (nl) > (data (select-by-class (children nl) 'data-char)))) > > Here's an example using the SGML backend to just spit out the data. > > (element TITLE (make formatting-instruction > data: (element-data (current-node)))) > > -Brandon :) > > > DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist > DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: (data..), (attribute-string...), Brandon Ibach | Thread | Re: (data..), (attribute-string...), shennessy |
I need information about SGML to HT, miguel . mata | Date | docbook/test/xtables.sgm - Jadetex , Glenn Kronschnabl |
Month |