You could use:
Code:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="itemKey" select="'cpu_type'"/>
<xsl:template match="/">
<data><xsl:value-of select="(dict/key[. = $itemKey]/following-sibling::string)[1]"/></data>
</xsl:template>
</xsl:stylesheet>
or you could use a key for efficiency:
Code:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="itemKey" select="'cpu_type'"/>
<xsl:key name="valueFromKey" match="dict/string" use="preceding-sibling::key[1]"/>
<xsl:template match="/">
<data><xsl:value-of select="key('valueFromKey', $itemKey)"/></data>
</xsl:template>
</xsl:stylesheet>
In general selecting by position is a pain. Much easier if your dictionary was something like:
Code:
<dict>
<item key="bus_speed">167 MHz</item>
<item key="cpu_type">PowerPC G4 (1.2)</</item>
</dict>
--
Joe (
Microsoft MVP - XML)