当使用xsl:param渲染变量中的值并在for循环中使用时,我无法输入for循环

问题描述:

<p>Title: <xsl:value-of select="$section_map" /></p> 

请注意,上面的section_map变量是打印值/form/medical-info/question-categories/question-category当使用xsl:param渲染变量中的值并在for循环中使用时,我无法输入for循环

现在我想经营我通过两种方式循环:

1路:

<xsl:for-each select="$section_map">...my code here ..</xsl:for-each> 

第二个办法:

<xsl:for-each select="/form/medical-info/question-categories/question-category">...my code here ..</xsl:for-each> 

当我用我的for循环首先使用办法。它无法进入ins循环。

在第二种方式,它正在执行罚款。

请告诉我可能是什么问题?

请在这里找到

<?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> 

section_map了我的XSL代码是一个字符串:

<xsl:variable name="section_map" 
select="concat('/form/',$sectionMap ,'/question-categories/question-category')"> 

你怎么指望for-each呢?

也许你应该尝试select="/form/*[name()=$sectionMap]/question-categories/question-category"或者其他的呢?