<p>Title: <xsl:value-of select="$section_map" /></p>
Note the above section_map variable is printing value /form/medical-info/question-categories/question-category .
Now i am trying to run my for loop by two ways:
1st way :
<xsl:for-each select="$section_map">...my code here ..</xsl:for-each>
2nd way :
<xsl:for-each select="/form/medical-info/question-categories/question-category">...my code here ..</xsl:for-each>
When i am using my for loop using first way. It is not able to enter insde the loop.
where as in second way it is executing fine.
Kindly tell me what could be the issue?
Kindly find the my xsl code here
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"
xmlns:date="http://exslt.org/dates-and-times" xmlns:str="http://exslt.org/strings">
<xsl:output method="html" indent="yes" encoding="UTF-8"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
<xsl:template match="/form">
<xsl:param name="sectionMap" select="'medical-info'"/>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head></head>
<body>
<form name="myform" id="myform" method="post" action="/admin/eapp/testForm">
<xsl:variable name="section_map" select="concat('/form/',$sectionMap ,'/question-categories/question-category')"></xsl:variable>
<p>Title: <xsl:value-of select="$section_map" /></p>
<xsl:for-each select="$section_map">
</xsl:for-each>
</form>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The
section_mapis a string:how do you expect to
for-eachabout it?Maybe your should try
select="/form/*[name()=$sectionMap]/question-categories/question-category"or some such instead?