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

RE: Not Node() but string onlye

Subject: RE: Not Node() but string onlye
From: "Karl Stubsjoen" <karl@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 7 Jan 2005 23:22:56 -0700
node to string
What I'm after is the value of the text node when there are no child other
(what do you call these?) nodes... but, if there are child nodes, then I am
interested in the value of one of them, in my case, the value of the child
node defaultvalue.  Take this example then:

<mynode>A text Node</mynode>

<mynode>
    <node_a>could be anything</node_a>
    <node_b>could also be anything</node_b>
    <defaultvalue>this is what I want</defaultvalue>
</mynode>



-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Sent: Saturday, January 08, 2005 10:14 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Not Node() but string onlye



>
> I am using this:
> <xsl:when test="not(node()) and string(.)">
>
> To test if a node has "No Child Nodes" but contains "String only".

If an element has no children, then its string value will always be "".

> So example:
>
> <!-- This should FAIL above test -->
> <mynode>
>     I hope
> </mynode>
>

Perhaps you are overlooking that the element <mynode> has one text node
child.

Michael Kay
http://www.saxonica.com/

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.