Re: [xsl] Newbie question, commenting out an element

Subject: Re: [xsl] Newbie question, commenting out an element
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 22 Dec 2008 12:02:09 -0500
Doug,

At 01:39 PM 12/21/2008, you wrote:
Thank you ... I had thought of using perl. In fact the transformation
script is a perl script that first converts from SGML to XML and then
changes graphic names and bunch of other strings. The problem for me
with perl is that I have to do more work to handle items, like
elements starting on one line and finishing on another. I wanted to
move from my serial and string based approach to XSL thinkin' I could
get my skills more current and do more with less effort.

This is true, and the fact that you've happened on a counter-example doesn't disprove it in the general case.


Extension functions like Saxon's parse() and serialize() allow you to cross the line that XSLT draws between string processing and tree transformation. Similarly, many processors have various ways of calling out to external utilities. But part of the issue here is that your requirement implicitly asks for a change in the XML text stream (write comment delimiters around a chunk of tags-and-text), not in the tree that results from parsing it. (Even using saxon:serialize() you may not get precisely the same tagging inside the comment as you had before your file was parsed.) Accordingly, a clean solution would work on that level. For example, a SAX filter could perform your task simply and fast.

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 ======================================================================

Current Thread