This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why aren't DENSITY & DISTANCE text displayed?

 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all!
I just want to get something clear about default template rules. I have the following XML file and XSL stylesheet:

When I do the transformation I get a table that displays the name, mass, radius, and day of Mercury. What I am wondering is why doesn't the text data for the density & the distance get generated outside the table? Is this because the template for PLANET explicitly states what to do so that the density and distance elements aren't even looked at?
I guess my question is if you have a template or templates for a node (with a match attr) will this prevent the default template rule from being applied to sibling nodes even if they fail the match test? I just want to be very clear on how default template rules get applied.
The example XML & XSL files are based on the examples in Inside XSLT by Steven Holzner.
Thanks,
John
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess my question is if you have a template or templates for a node (with a match attr) will this prevent the default template rule from being applied to sibling nodes even if they fail the match test?
I believe so. If you want to allow child nodes processing, add <xsl:apply-templates/> at the end of the template
<xsl:template match="PLANET">
   <TR>
       <TD><xsl:value-of select="NAME"/></TD>
       ...
       <xsl:apply-templates/>
   </TR>
</xsl:template>
and see all default templates at work
[ March 17, 2002: Message edited by: Mapraputa Is ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic