This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How to display only certain nodes


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"
authorID="554215">
   <authorName><![CDATA[ Mr. Author 1 ]]></authorName>
   <subject><![CDATA[ My Subject 1]]></subject>
   <msg><![CDATA[ My Message ]]></msg>
 </Message>

 ... more message nodes here...
</Topic>


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 />
	</table>
</xsl:template>

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

</xsl:stylesheet>


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]