[xsl] How to display only certain nodes

Subject: [xsl] How to display only certain nodes
From: "Scott Zagar" <scottz@xxxxxxxxxxxxx>
Date: Wed, 13 Jun 2001 11:44:34 -0700
I suppose this is a newbie question, not sure how to look it up in the
archive, so here goes...

I have a BBS thread xml string that looks like this:

<Topic t_ID="60489" t_replies="86" t_moderatorID="554215" t_access="3">
 <t_topicName><![CDATA[ MyTopic ]]></t_topicName>
 <t_moderatorName><![CDATA[ Mr. Moderator]]></t_moderatorName>
 <t_dateStarted><![CDATA[ 6/10/2001 5:09:27 PM  ]]></t_dateStarted>
 <t_lastPost><![CDATA[ 6/11/2001 4:33:06 PM ]]></t_lastPost>

 <Message ID="429487" parentID="0" orderID="1." replyLevel="0"
   <authorName><![CDATA[ Mr. Author 1 ]]></authorName>
   <subject><![CDATA[ My Subject 1]]></subject>
   <msg><![CDATA[ My Message ]]></msg>

 ... more message nodes here...

Using ASP/msxml3.0, I'm feeding the XML into an XSL stylesheet:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; >
<xsl:output method="html" indent="no"/>

<xsl:template match="/">
	<table width="90%" cellpadding="1" cellspacing="1" border="0">
		<xsl:apply-templates />

<xsl:template match="Message">
  ... HTML to display the message ...


The displaying of the messages works fine, but the problem is that all of
the text contained in the Topic node is getting printed out onto the page,
just dumped out before the message nodes get parsed. I've using some
variations on the first "template match" bit, like template match="/Topic",
or template match="/Message", but I haven't been able to get the results I
want, which is to simply ignore the topic information and print out the
messages. I could always reformat the XML so that there is no topic
information and only message nodes, but I'm sure there has to be a way to
simply ignore the topic information. Plus, I'd like to be able to use the
same xml file for different purposes.

Any advice would be much appreciated, thanks in advance

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

Current Thread