xsl-list
[Top] [All Lists]

RE: Not Node() but string onlye

2005-01-07 23:22:56
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(_at_)saxonica(_dot_)com]
Sent: Saturday, January 08, 2005 10:14 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] 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/


--~------------------------------------------------------------------
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>
--~--


--~------------------------------------------------------------------
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>