xsl-list
[Top] [All Lists]

RE: xsl:template match problem

2004-04-17 09:13:49
Here is one solution:

<!-- pass in all children of ROOT/NODES who do not have 'EXCL' in their
name.
<xsl:template match="/">
        <xsl:apply-templates select="ROOT/NODES/*[not(contains(name(.),
'EXCL'))]"/>
</xsl:template>

-----Original Message-----
From: Sam Saha [mailto:sam_saha1975(_at_)yahoo(_dot_)ca] 
Sent: Saturday, April 17, 2004 12:00 PM
To: XSL List
Subject: [xsl] xsl:template match problem

Hi,
 How do I write an exclusion template that avoids all
the nodes that start with a particular value, in the
output.

I have this XML.

<ROOT>
  <NODES>
     <NODE_1>VALUE</NODE_1>
     <NODE_2>VALUE</NODE_2>
     <NODE_3>VALUE</NODE_3>
     <NODE_4>VALUE</NODE_4>
     <NODE_5>VALUE</NODE_5>
     <NODE_6>VALUE</NODE_6>
     <NODE_7>VALUE</NODE_7>
     <NODE_8>VALUE</NODE_8>
     <EXCL_1>exval</EXCL_1>
     <EXCL_2>exval</EXCL_2>
     <EXCL_3>exval</EXCL_3>
     <EXCL_4>exval</EXCL_4>
     <EXCL_5>exval</EXCL_5>
  </NODES>
</ROOT>

I am doing the the following in the XSLT 

<xsl:apply-templates select="ROOT/NODES/*" />

And I have this template that matches the nodes:

<xsl:template match="node()">
        <!-- Do output -->
</xsl:template>

I am thinking of having an exclusion template that
matches all the nodes that starts with 'EXCL_' and do
nothing.
I am getting stuck with this.

<xsl:template match="How_to_write_this" />


Thanks for your help.

Sam.


______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--




<Prev in Thread] Current Thread [Next in Thread>