This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: not selecting child elements with same name as parent...


Thanks for that detailed response!
option #3 worked great with the <xsl:copy-of
select="text()"/>

--
Anthony E.

--- Evan Lenz <elenz@xyzfind.com> wrote:
> > > > <xsl:value-of select="text()"/>
> > > >
> > > That's dangerous, it will only select the first
> child text node.
> >
> > But wasn't that exactly what was required in the
> orginal question?
> 
> No. There have been three possibilities discussed so
> far, as shown below. A
> concrete example follows.
> 
> 1) string-value of an element, which is the
> concatenation of all
> *descendant* text nodes (what Anthony tried)
> 
> <xsl:value-of select="."/> (where "." is the current
> node, an element)
> 
> 2) string-value of first child text node (what you
> suggested)
> 
> <xsl:value-of select="text()"/>
> 
> 3) string-value of each child text node (the correct
> solution to Anthony's
> problem)
> 
> <xsl:for-each select="text()">
>   <xsl:value-of select="."/>
> </xsl:for-each>
> -OR-
> <xsl:copy-of select="text()"/>
> 
> 
> Example (where the foo element is the current node
> in each of the above):
> 
> <foo>The <bar>quick</bar> brown fox jumped
> <bat>over</bat> the lazy
> dog.</foo>
> 
> #1 will produce "The quick brown fox jumped over the
> lazy dog."
> #2 will produce "The "
> #3 will produce "The  brown fox jumped  the lazy
> dog."
> 
> As it happens, the example he gave would result in
> the difference of only
> one line break between #2 and #3, but the way he
> specified the problem
> indicated it was in fact #3 that he wanted.
> 
> Hope this helps,
> Evan
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]