[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

How to display only certain nodes

Subject: How to display only certain nodes
From: "Scott Zagar" <scottz@xxxxxxxxxxxxx>
Date: Wed, 13 Jun 2001 11:44:34 -0700
scott zagar
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.