Abie,
At 11:17 AM 9/8/2003, you wrote:
hello,
I want to be able to generate an xml element using <xsl:element/attribute,
etc. such that the output xml file has a newline between each
attribute. my hunch is that this is impossible in current tools b/c xml
is content- rather than display- oriented, but I wanted to at least ask.
Your hunch is correct, though like many hunches, not exactly for the
reasons it suspects.
It's impossible not because of the "orientation" of XML as such, but
because of the way XSLT's processing model is designed.
Note I infer "current tools" to mean current XSLT tools.
That is, the job is *not* impossible when working outside of XSLT's
tree-to-tree conversion model -- more particularly, when working with an
application that gives you hands-on access to the document serialization.
Accordingly, the XSLT solution to your problem is to write yourself a
serializer (how's your Java? Python?) and hook that in at the end of a
transform, instead of using the one your XSLT processor comes with (which
isn't designed to work this way). Once you've got your hands in there you
should be able to get your XML written however you like (the risk being
that it might not be XML when you're done with it).
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.
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