[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Conditional extraction of data

Subject: RE: Conditional extraction of data
From: "Bradley, Peter" <PBradley@xxxxxxxxxx>
Date: Mon, 8 Nov 2004 14:44:51 -0000
RE:  Conditional extraction of data
Yeah.  This neatly sums up the problems I've been having.  An XPath expression
always seems to return an entire sub-tree, and it seems to me that I just want
a single node in this case.  Will xsl-copy give me that?

Peter

 -----Original Message-----
From: 	Geert Josten [mailto:Geert.Josten@xxxxxxxxxxx]
Sent:	08 November 2004 14:42
To:	xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:	Re:  Conditional extraction of data

M. David Peterson wrote:

> ooops!
>
> This portion:
>
> <xsl:value-of select="foo"/> will output: "this is the value of foo"
>
> <xsl:value-of select="foo"/> will output a copy of all the text elements
> as well as the elements and there values that are descendants of foo. o
>
> should have read...
>
> <xsl:value-of select="foo"/> will output: "this is the value of foo"

Not true. xsl:value-of takes the first element from the node-set that results
from the expression
"foo" and converts that to a string. As both sub elements <bar> and <p> are
_inside_ element <foo>,
their textual content is returned as well.

The output is therefore: "
    this is the value of foo
    this is the value of bar.this is the value of a paragraph that is the
child of bar
"

(including new-lines when white-space is preserved)

> <xsl:copy-of select="foo"/> will output a copy of all the text elements
> as well as the elements and there values that are descendants of foo.
>
> Sorry for the confusion!
>
> <M:D/>

Grtz,
Geert

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.