Altova Mailing List Archives

RE: [xsl] Not Node() but string onlye

From: "Karl Stubsjoen" <karl@-------------------->
Date: 1/8/2005 6:19:00 PM
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>

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

-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Sent: Saturday, January 08, 2005 10:14 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
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

Michael Kay


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.