RE: [xsl] Preserving XHTML markup

Subject: RE: [xsl] Preserving XHTML markup
From: Eric Vitiello <xsl-list@xxxxxxxxxxxx>
Date: Mon, 4 Feb 2002 14:40:39 -0500
-- 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 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.

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.



---
Eric Vitiello
Perceive Designs
<www.perceive.net>


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


Current Thread