RE: [xsl] Preserving XHTML markup

Subject: RE: [xsl] Preserving XHTML markup
From: "Julian Reschke" <julian.reschke@xxxxxx>
Date: Mon, 4 Feb 2002 21:27:31 +0100
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Eric Vitiello
> Sent: Monday, February 04, 2002 8:41 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Preserving XHTML markup
>
>
> -- Julian Reschke [Mon, 4 Feb 2002 20:19:26 +0100]:
> >> this brings up an interesting question.
> >>
> >> which is preferred, using xsl:copy-of or putting the XML in CDATA
> >> tags, and using value-of?
> >
> >If you can control your markup and can be sure that it's well-formed
> >XHTML, why escape it? If you do, it's almost impossible to be processed
> >with XSLT.
>
> why is it impossible for it to be processed with XSLT? I've never
> had any problem doing so.

I was talking about processing in the sense of doing more than copying it to
the output tree. For instance applying templates to specfic HTML elements.

> >> I suppose it depends quite a bit on if the data is content or
> >> construction - i.e. is his "Some HTML <b>here</b>"
> >>
> >> actual content, or is it part of the structure of the XML document?
> >
> >What's the difference?
>
> The difference between structure and content?  The structure of
> the document is simply there to hold the content in a manner that
> makes it easy to distinguish between one portion of data/content
> and another.

Sure, but I think the distinction can be fuzzy. Just because something is
"content", it doesn't mean that it would benefit from mark-uped structure.

> for example, say we have a bunch of babies, and information about
> them.  you might have a document such as:
>
>
> <?xml version="1.0">
> <babies>
> 	<baby>
> 		<weight>5 lbs</weight>
> 		<length>21 inches</length>
> 		<name>Baby Joe</name>
> 	</baby>
> 	<baby>
> 		<weight>6lbs 2oz</weight>
> 		<length>16 in</weight>
> 		<name>Baby Jane</name>
> 	</baby>
> </babies>
>
>
> without the structure, it would be hard to distinguish what data
> is what - it would look like:
>
> 5 lbs 21 inches Baby Joe 6lbs 2oz 16 in Baby Jane
>
> which is nearly useless, and would be terrible to parse.
>
> the structure of the document holds everything together, just as
> the structure of a building does.
>
> We never confuse the occupants of a building with it's structure,
> and in the same vein, we should keep a distinct line between the
> structure and content of an XML document.
>
> Sometimes, the content itself is XML, and to distinguish between
> this xml and the main structure, CDATA blocks are used.

I think this is a bad idea. If your content is XML, don't escape it. It will
make processing much more complicated if you do.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread