This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: element nodes in a string?


Chris,

You're doing great with this -- the recursive template to process the text 
string is just about right -- but unfortunately you've now taken XSLT 1.0 
about to the limit of what it can do with this, at any rate easily.

XSLT is just not built to support processing on plain text, which is what 
you're trying to do.

Maybe with an extension function such as node-set(), or the ability to 
match on ranges of characters, or some other capability not described in 
the 1.0 spec, someone can see a way to go further and catch the nestings 
you are (rightly) concerned about. Heck, I'll bet someone on this list 
could even offer a solution in XSLT 1.0. I'd sure like to see it: but it'll 
fall into the "teaching a dog to dance" category.

This would be much, much easier in Omnimark or Perl -- Omnimark is designed 
for just this kind of conversion, and Perl excels at plain text processing. 
Or Python, or....

(Sometimes, a wrench just isn't the right tool. Now, if you were going from 
structured markup *into* plain text, it'd be easy.)

Good luck,
Wendell

At 09:42 PM 5/24/01, you wrote:
>I am a complete XML/XSLT newbie.  I have spent a lot
>of time reading the FAQ and archives, but I can't find
>an answer to my problem.
>
>I have a well-formed XML document as follows:
>
><top>
><text>Each text field contains arbitrary text.  It
>could also contain
>
>paragraph breaks, _underscores_, and ~phrases
>delimited by tildes~.
></text>
><text>Underscores and tildes are guaranteed to come in
>pairs, or _not at all_ in a given text field.
></text>
></top>
>
>What I want to do is to process each of these text
>fields, underlining text between underscores,
>italicizing text between tildes, and keeping paragraph
>breaks as they are, and output them in html and
>(later) rtf.



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]