xsl-list
[Top] [All Lists]

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

2006-12-08 11:41:20

I totally buy that - mostly we're making xsl without control over the
xml.. In answering OP (or MP?)'s ques I acted on my first impulse which
was to complain about the bad xml.

Regards
Vikram



-----Original Message-----
From: Wendell Piez [mailto:wapiez(_at_)mulberrytech(_dot_)com] 
Sent: Friday, December 08, 2006 1:25 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] How to extract data from an element and not from its
children

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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • RE: [xsl] How to extract data from an element and not from its children, Dhunta, Vikram \(GE, Corporate\) <=