<xsl:value-of select="/member/@name"/>

解决方案 »

  1.   

    抽出HasField(DataTable source, String field)。是什么意思?
      

  2.   

    you shouldn't do complicated string manipulation in XSLT, you should do it in your application code instead. But if you insist, try1. xml:
    <member name="M:WebControls.DBTreeView.HasField(System.Data.DataTable,System.String, System.Drawing.Color)">
       <summary>
            判断DBTreeView控件的数据源source中是否含有指定的字段field。
       </summary>
       <param name="source">DBTreeView控件的数据源。</param>
       <param name="field">指定数据源中的字段。</param>
       <param name="field2">指定数据源中的字段。</param>
       <returns>如果数据源中有指定的字段,返回true,否则返回false。 </returns>
    </member>
    2. xsl:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" />

    <xsl:variable name="params" select="member/param" /> <xsl:template match="/">
    <!--get function signature -->
    <xsl:variable name="func">
    <xsl:value-of select="substring-after(substring-after(member/@name,'.'),'.')" />
    </xsl:variable>

    <!--get function name -->
    <xsl:variable name="funcname">
    <xsl:value-of select="substring-before($func,'(')" />
    </xsl:variable>

    <!--get paramater list -->
    <xsl:variable name="formalparamlist">
    <xsl:value-of select="substring-before(substring-after($func,'('),')')" />
    </xsl:variable>

    <!--construct call list -->
    <xsl:variable name="realparamlist">
    <xsl:call-template name="makeParamList">
    <xsl:with-param name="paramlist" select="$formalparamlist" />
    </xsl:call-template>
    </xsl:variable>

    <xsl:value-of select="$funcname" />
    <xsl:text>(</xsl:text>
    <xsl:value-of select="$realparamlist" />
       <xsl:text>)</xsl:text>

    </xsl:template>

    <!--remove namespace -->
    <xsl:template name="getDataType">
    <xsl:param name="DataType" />
    <xsl:choose>
    <xsl:when test="contains($DataType,'.')">
    <xsl:call-template name="getDataType">
    <xsl:with-param name="DataType" select="substring-after($DataType,'.')" />
    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$DataType" />
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>

    <xsl:template name="makeParamList">
    <xsl:param name="paramlist" />
    <xsl:param name="pos" select="1" />
    <xsl:choose>
    <xsl:when test="contains($paramlist,',')">
    <xsl:call-template name="getDataType">
    <xsl:with-param name="DataType" select="substring-before($paramlist,',')" />
    </xsl:call-template>
    <xsl:text> </xsl:text><xsl:value-of select="$params[$pos]/@name" /><xsl:text>,</xsl:text>

    <xsl:call-template name="makeParamList">
    <xsl:with-param name="paramlist" select="substring-after($paramlist,',')" />
    <xsl:with-param name="pos" select="$pos + 1" />
    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
    <xsl:call-template name="getDataType">
    <xsl:with-param name="DataType" select="$paramlist" />
    </xsl:call-template>
    <xsl:text> </xsl:text><xsl:value-of select="$params[$pos]/@name" />
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    </xsl:stylesheet>