RE: How to extract data from an element and not from i
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@xxxxxxxxxxxxxxxx] Sent: Friday, December 08, 2006 1:25 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: 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()" 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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format