Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 28th, 2011, 06:05 PM
Registered User
 
Join Date: Jan 2011
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default Node text()

Hi

I have a xml like this:

<function><name>PAL_c</name> <parameter_list>()</parameter_list> </function>

<function><name>F1</name><parameter_list> (<param><decl><type><name>void</name></type></decl></param>)</parameter_list>

The out for the first example should be:
PAL_c ()

The second:
F1 ( < span class="void"> void </span>)

I do not how to get the node text() that working in all the cases.

Somebody have any idea.
 
Old January 28th, 2011, 06:40 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Something like this:

Code:
<xsl:template match="function">
  <xsl:value-of select="name"/>
  <xsl:text>(</xsl:text>
  <xsl:apply-templates/>
  </xsl:text>)</xsl:text>
</xsl:template>

<xsl:template match="param">
  <span class="{.}"><xsl:value-of select="."/></span>
</xsl:template>
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a node to an existing xml node list. codehelp C# 2008 aka C# 3.0 2 October 12th, 2009 07:41 AM
Searching text within a node LeeSir XSLT 3 August 6th, 2009 09:07 AM
Displaying data as a Parent Node with Left Node and Right Node Manoj Bisht Visual Basic 2008 Professionals 0 April 2nd, 2009 02:34 AM
substitute text() node value in XPath expression Coolcampers XSLT 4 April 30th, 2008 08:39 AM
How to select a node or text from treeview MacDevv C# 2005 3 September 5th, 2006 05:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.