* selects all nodes of the principal node type for the relevant axis. What this means in English is that unless you are using the attribute axis or the namespace axis you will get elements. Not all nodes are elements, attributes for instance.
[code]
<ingredients>
<item type="fruit">apples</item>
<item type="basic">flour</item>
<item type="basic">sugar</item>
<item type="dairy">milk</item>
<item type="basic">salt</item>
<item type="dairy">butter</item>
</ingredients>
[code]
With the above source try this xslt:
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:text>#x0a;</xsl:text>
select="ingredients/*":<xsl:text>#x0a;</xsl:text><xsl:text>#x0a;</xsl:text>
<xsl:for-each select="ingredients/*">
<xsl:value-of select="."/><xsl:text>#x0a;</xsl:text>
</xsl:for-each>
select="ingredients/attribute::*":<xsl:text>#x0a;</xsl:text><xsl:text>#x0a;</xsl:text>
<xsl:for-each select="ingredients/item/attribute::*">
<xsl:value-of select="."/><xsl:text>#x0a;</xsl:text>
</xsl:for-each>
select="ingredients/item/node()":<xsl:text>#x0a;</xsl:text><xsl:text>#x0a;</xsl:text>
<xsl:for-each select="ingredients/item/node()">
<xsl:value-of select="."/><xsl:text>#x0a;</xsl:text>
</xsl:for-each>
select="ingredients/node()":<xsl:text>#x0a;</xsl:text><xsl:text>#x0a;</xsl:text>
<xsl:for-each select="ingredients/node()">
<xsl:value-of select="."/><xsl:text>#x0a;</xsl:text>
</xsl:for-each>
select="ingredients/attribute::node()":<xsl:text>#x0a;</xsl:text><xsl:text>#x0a;</xsl:text>
<xsl:for-each select="ingredients/item/attribute::node()">
<xsl:value-of select="."/><xsl:text>#x0a;</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Joe (MVP - xml)