xsl-list
[Top] [All Lists]

Re: formatting xml output: inserting newlines between generated attributes

2003-09-09 09:50:02
Abie,

At 10:15 AM 9/9/2003, you wrote:
Alternatively, there are ways to cheat -- for example, you could write a transformation that would >output plain text that would "happen to be" XML -- and that would contain the line breaks you >wanted.

It would, however, be a nightmare to combine this strategy with a regular every-day transformation, >though I can see it being done as a post-process.

wendell,
this is exactly what I was going to do in case the answer to my original question was in the negative. I would use <xsl:output method="text"> and just format the xml by hand, as it were. why do you say it would be a nightmare? (granted it's not as elegant).

If you kept it in its own box, completely separate from other transformation logic, it would be fine. The nightmare would be if you tried to combine this with ordinary transformation logic, which typically would perform a mapping of source elements to result elements, do grouping, conditional generated text, etc. Both things happening in a single stylesheet would be a lot to try to keep under control and a pain to maintain. Also, writing output to text locks you into a particular processing model (can't chain the transform as easily, can't use it in display engines that don't support the 'text' output method, and so forth).

Writing a transform to do such reformatting on arbitrary input, and having it be the final step of a two- (or multi-) step process, is more thinkable. Three or four templates would do everything you would need. Is there any reason you can't do it that way? (Or maybe you're saying that's what you want to do.)

Cheers,
Wendell


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
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