I don't like the XML, better to have each matrix value in a separate element. Given this XML:
Code:
<root>
<contractions elementType="H">
<description>(3s) -> [2s]</description>
<contraction shell="S">
<matrix rows="2" columns="2" dataType="double">
5.447178 0.156285
0.824547 0.904691
</matrix>
</contraction>
<contraction shell="S">
<matrix rows="1" columns="2" dataType="double">
0.183192 1.000000
</matrix>
</contraction>
</contractions>
<contractions elementType="N">
<description>(3s) -> [2s]</description>
<contraction shell="S">
<matrix rows="2" columns="2" dataType="double">
5.447178 0.156285
0.824547 0.904691
</matrix>
</contraction>
<contraction shell="S">
<matrix rows="1" columns="2" dataType="double">
0.183192 1.000000
</matrix>
</contraction>
</contractions>
</root>
This stylesheet gives the values. I don't know how you're passing $Values, it must be a nodeset not a string to do a for-each.
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:call-template name="getElementShellType">
<xsl:with-param name="Values" select="'H'" />
</xsl:call-template>
</xsl:template>
<xsl:template name="getElementShellType">
<xsl:param name="Values" />
<xsl:variable name="contractions" select="/*/contractions[@elementType = $Values]" />
<xsl:for-each select="$contractions/contraction">
<xsl:text>Shell:#xa0;</xsl:text>
<xsl:value-of select="@shell" /><xsl:text>#x0d;</xsl:text>
<xsl:text>Matrix:#xa0;</xsl:text>
<xsl:value-of select="matrix" /><xsl:text>#x0d;</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
--
Joe (
Microsoft MVP - XML)