Subject: RE: More XSL Discussion
From: Jonathan Marsh <jmarsh@xxxxxxxxxxxxx>
Date: Thu, 26 Feb 1998 09:15:11 -0800
|
/ Sean Mc Grath <digitome@xxxxxx> was heard to say:
[...]
| Real World Example:
[...]
| Part : Introduction
| Chapter : The Foo Manual
| Section : Introduction
| 1. The Foo Manual is a work of epic proportions...in the future.
|
/ Norman Walsh [mailto:norm@xxxxxxxxxxxxx] said on Thursday, February 26,
1998 4:40 AM
| The only wrinkle at the moment is grabbing the first and last
| ten words out of the paragraphs. XSL needs to be able to do
| this, but I don't think we've figured out how yet.
Sure we have. This is a classic case where escape to script makes sense.
This particular formatting operation is not in the 90%-common case (or even
99% case), and so should not result in complicating the declarative parts of
XSL. A graceful escape to script for purposes like this should support this
kind of customized (in this case string-level) formatting.
Something like this:
<define-script>
function myTextTrimmingFunction(string) {
// arbitrary string manipulation goes here
return result;
}
</define-script>
<rule>
<target-element type="p">
<paragraph>
<eval>myTextTrimmingFunction(this.text)</eval>
</paragraph>
</rule>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|