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]
Other format: [Raw text]

Re: tag minimisation


Hi Andrew,

>> The use xsl:output method="html" and it won't happen.
>
> What if you want xml output that will subsequently be used as html,
> such as in a chain of transformations?

Then surely the process at the end of the line is responsible for how
the eventual HTML is output? In a pipeline of operations on an XML
document, I would have thought that the document received as input to
the process after the transformation you're talking about should be
processed as an information set rather than as a sequence of
characters (and if it *is* being processed as a sequence of characters
then I doubt it's XML-aware, in which case using the 'html' output
method shouldn't matter).

> Other than for visual neatness, why minimise elements?

Every choice made when serialising an XML document (whether to use "
or ' around attribute values, whether to use CDATA sections or
individual escapes, whether to use decimal or hexadecimal character
references etc. etc.) is about how it *looks* rather than what the
document *means*. The only reason you could possibly have for
preferring one serialisation over another is your own idea of "visual
neatness".

The reason you're having problems with the empty element syntax in web
browsers is because web browsers aren't XML processors and therefore
don't understand the fact that in an XML world, <div /> (or <div/>)
means *exactly* the same as <div></div>.

What I suggest you do is one of the following:

  - post process your XML with an identity transformation that turns
    all empty div elements into div elements that contain a comment.

  - use the XHTML output method, if your processor supports it

  - write your own Serialiser for the processor that you're using, and
    use that serialiser instead of the one the processor comes with.

The first is a bit of a hack, but there you go.
    
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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]