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 December 2nd, 2008, 10:25 AM
Registered User
 
Join Date: Dec 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Not outputting a specific node

Hi again, apologies for posting twice in a row, I will definately be sorted once this is answered.

I can include a specific node with:

<xsl:template match="nodename" >

But is it possible to actually exclude a specific node?

Or rather, if I was to start from the root:

<xsl:template match="/" >

Is there a way of actually specifying a node that I don't want to print in the output?

Thanks for your help.

 
Old December 2nd, 2008, 10:31 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Well if you use an empty template e.g.
Code:
<xsl:template match="foo"/>
then the processor will do nothing with 'foo' elements.

--
  Martin Honnen
  Microsoft MVP - XML
 
Old December 2nd, 2008, 10:38 AM
Registered User
 
Join Date: Dec 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ay, but the thing is I want to ignore them the first time I print the whole thing, and then print them out seperately at the bottom. Thus I already have a section for the specific node describing the format.

 
Old December 2nd, 2008, 10:49 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Well you can then use the "mode" attribute:

<xsl:template match="foo"/>

<xsl:template match="foo" mode="bar">
  <foo>is the bar</foo>
</xsl:template>

Any instance of a normal <xsl:apply-templates/> will use the first one, but where you do want to print them out you can then do: <xsl:apply-template select="//foo" mode="bar"/>

/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Introducing parent node to specific siblings Frimann XSLT 11 July 3rd, 2008 03:20 PM
Search specific data from specific columns yogeshyl SQL Language 1 January 16th, 2008 11:12 AM
Copy specific data in specific cells of sheet2 yogeshyl Excel VBA 1 May 14th, 2007 07:40 AM
Copying Source Node attributes to output node pvsat XSLT 2 November 3rd, 2005 09:46 AM
Need to apply to only a specific node based on var rfleming XSLT 1 November 17th, 2004 05:16 PM





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