Suppose you have an xml file that has a portion that looks like:

<div id="California">The cat is in the house
<p>The horse is also in the house</p>
<div><a href="wwww.whatever.com" /><p>Another pigeon?</p></div>
</div>

Since the top div here is buried somewhere within the file, I am trying to isolate it with
<xsl:template match="//div[@id="California">
<xsl:value-of select="????">
...

but I want the only thing to get transferred to the output file to be "The cat is in the house" I realize that in the node tree that forms the input, this is the text child of the <div id="California> tag, but I don't know how to get the this to be selected by the
<xsl:value-of> tag. How do I do that?

Recommended Answers

All 2 Replies

It's the first text() node so :

<xsl:value-of select="text()[1]">

It is indeed the first text node, so cool, now you know why I am a newbie. I wll try this momentarily.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.