Matching Element Descendants

Matching Element Descendants

In the preceding section, I used the expression "PLANET/ NAME " to match all <NAME> elements that are direct children of <PLANET> elements, and the expression "PLANET/*/NAME" to match all <NAME> elements that are grandchildren of <PLANET> elements. However, theres an easier way to perform both matches: just use the expression "PLANET//NAME" , which matches all <NAME> elements that are inside <PLANET> elements, no matter how many levels deep (the matched elements are called descendants of the <PLANET> element). In other words, "PLANET//NAME" matches "PLANET/NAME" , "PLANET/*/NAME" , "PLANET/*/*/NAME" , and so on:

 <xsl:template match="PLANETS//NAME">      <H3>          <xsl:value-of select="."/>      </H3>  </xsl:template> 


Inside XSLT
Inside Xslt
ISBN: B0031W8M4K
EAN: N/A
Year: 2005
Pages: 196

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net