RE: [xsl] How to extract data from an element and not from its children

Subject: RE: [xsl] How to extract data from an element and not from its children
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 08 Dec 2006 13:25:07 -0500
Vikram,

At 01:39 PM 12/6/2006, you wrote:
If it's textual content, I agree.. We certainly want to continue with
<p>Hello, <b>World!</b></p>

But if it's data, and since you're using xml, you obviuosly intend to
imitate a real world hierarchy/structure, wouldn't the following seem
strange:
<hardware>
<screws>
This is the description of screws
<screw>
One
</screw>
</screws><screws>
This is a specification of screws
<screw>
Two
</screw>
</screws></hardware>

By orphaning that text without a node, you take away the (meta-)meaning
of the text. Doesn't that defeat the purpose of using xml to describe
data so it can be used by other readers, human and machine?

There was no indication in the OP's question that this was the case. Rather, the question was asked very generally.


This is like someone saying "how do I slice up my chiles" and your saying "it seems a bit strange to add chiles" and when I say "but there's nothing wrong with chiles" you say "what if I'm making ice cream?"

Actually, maybe I'm being a bit hard on you ... it may actually be true that even having to use the construct xsl:value-of select="text()[1]" is an indication of poor design in general, for reasons you imply. But we don't know that for sure in this case. (We also can't assume the OP controls the design. Many people are writing XSLT to handle, and even improve, badly designed XML.)

As for the relevance of your post to the list -- it's perfectly within scope. Theoretical questions and debates are welcome, as long as they're related to XSL.

Cheers,
Wendell

To me, it gives me the same uncomfortable feeling as someone doing the
following in html:
<table>
<tr><td>Hello</td></tr>whoa whats this text doin here,..just don't
belong!
<tr><td>World</td></tr>
</table>

Rgds

(btw I'm a newbie here, I like this list, and if such debates are
considered spam, please don't reply and let it die :) )


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
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
======================================================================

Current Thread