Re: Rephrasing the problem [was Re: [xsl] Second try: Search and replace many strings that may not be present in target

Subject: Re: Rephrasing the problem [was Re: [xsl] Second try: Search and replace many strings that may not be present in target
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 21 May 2002 19:04:47 -0400
At 03:19 PM 5/20/2002, Greg wrote:
I figured it out just after sending... I was calling substring-before() and substring-after(), both of which convert a node to a string. An alternate (and more successful) way of doing what you want is to use d-o-e and CDATA sections, though it makes many XSLT'ers blood boil. Remember that d-o-e is not a mandatory option for an XSLT engine.

It's not that it makes our blood boil (why should you care about the state of my cardiovascular system? :-) or even that it's not universally supported ... it's that it locks the application into one processing model, namely one in which the output is written to a file. If you ever use XSLT another way -- maybe pipelining transforms or browsing client-side in Mozilla -- it'll break.


Personally I find d-o-e far less troublesome when I can be assured that writing to a file will Always Always happen. But that's a big thing to assume, especially when helping a friendly stranger who may not yet have become perfectly familiar with all the ins-and-outs of XSLT minutiae, and why one needs to ask such obscure questions about the operational scenario.

I agree with Stuart that this is only an XSLTish problem at a stretch. Partly because it's designed to be side-effect-free and not depend on a particular processing order, XSLT has trouble with such notions as "the first time a string occurs in the document, in any <p> element". It can be done but it involves some pretty creative twisting-and-turning. As Greg is kindly showing. :->

Regards,
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