XML File:
<generic-cv:generic-cv xmlns:generic-cv="http://www.cihr-irsc.gc.ca/generic-cv/1.0.0" lang="en" dateTimeGenerated="2014-05-30 11:40:50">
<section id="f589cbc028c64fdaa783da01647e5e3c" label="Personal Information">
<section id="2687e70e5d45487c93a8a02626543f64" label="Identification" recordId="4f7c2ebd789f407b939e05664f6aa7c0">
<field id="ee8beaea41f049d8bcfadfbfa89ac09e" label="Title">
<lov id="00000000000000000000000000000318">Mr.</lov>
</field>
<field id="98ad36fee26a4d6b8953ea764f4fed04" label="First Name">
<value type="String">Hara</value>
</field>
</section>
<section id="2687e70e5d45487c93a8a02626543f64" label="Identification" recordId="4f7c2ebd789f407b939e05664f6aa7c0">
<field id="ee8beaea41f049d8bcfadfbfa89ac09e" label="Title">
<lov id="00000000000000000000000000000318">Mr.</lov>
</field>
<field id="98ad36fee26a4d6b8953ea764f4fed04" label="First Name">
<value type="String">ali</value>
</field>
</section>
</section>
and an xslt file like this
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:variable name="FirstName" select=".//field[@id='98ad36fee26a4d6b8953ea764f4fed04']/value"/>
<xsl:template match="/">
<html>
<head>
<title>Xml Convertor</title>
</head>
<body>
<h2><b> Personal Information</b></h2>
<ul>
<xsl:for-each select=".//section[@id='2687e70e5d45487c93a8a02626543f64']" >
<li>Name: $FirstName></li>
</xsl:for-each>
</ul>
</body>
</html>
Instead of using specific code values to get to the right information in the xml file. I wanted to use (global) variables so that i can change the values easily. For instance, when i want to find and display (in html) the first name, i look for code "98ad36fee26a4d6b8953ea764f4fed04". Instead i want to set a variable, for instance firstName to this value and look for the variable value in the xml file.However when i set first name to variable and put it under a for each loop it will only print out the name Hara and not ali. Is there a way i can fix this problem without putting the variable declaration in the for each loop