[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: How do I capture the text "around" a node?
[Peter Lavender] > It is very confusing. > It can be, especially while you are getting used to the way xslt works. > While apply-templates works as you said, the problem i have > is that I want to remove the chars (), hence I tried value-of > Here is a really easy and readable way to do your task, based on apply-templates as several people have suggested already: <xsl:variable name='text'> <xsl:apply-templates select='text'/> </xsl:variable> <xsl:value-of select='translate($text,")(","")'/> The apply-templates brings in all the text, including text in any child nodes even though you may not know the names of the child elements, and even if some of the children are nested within each other. This happens because there is no template to match a "text" element, so the processor applies the built-in default templates, which get the text. The translate() function replaces the '(' and ')' characters with nothing, which gets rid of them. Cheers, Tom P XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|