I want to extract only the leaf nodes from an XML document (i.e., only elements that have no children). Has anyone written an xslt to do this?
A:
Using axes in XPath:
<xsl:apply-templates select="//you-node-spec[not(child::*)]" />
Dewfy
2009-08-27 16:34:13
This worked for me. Though I had to use 'SELECT="//*[not(*)]"'. I'm a xslt newbie and don't why the '//' part is necessary, but I'm still learning. Thanks for the help.
Great Kindness
2009-08-27 20:22:25
The "//" is so that it will find the condition "*[not(*)]" anywhere in the xml structure.
Irfy
2009-08-28 08:33:47