2013-03-16 54 views
0

解析WSDL时,遇到很多wsdl:importxsd:import元素。我想解析导入并将@location@schemaLocation传递给解析器。将参数传递给解析导入的文件

目的是在导入的文件导入文件例如filea.wsdl;filez.xsd;filev.xsd时增加文件列表。这样我可以消除以前导入的文件。

我想的东西沿着这些线路:

<xsl:param name="file-list"/> 

<xsl:template match="/"> 
    <xsl:param name="file-list"/> 
    <xsl:apply-templates /> 
</xsl:template> 

<xsl:template match="wsdl:import"> 
    <xsl:apply-templates select="document(@location)"> 
     <xsl:with-param name="file-list" select="concat($file-list, ';', @location)`"/> 
    </xsl:apply-templates> 
</xsl:template> 

回答

1

你的基本想法似乎是罚款。你只需要通过沿该file-list参数应用模板的时候,所以:

  1. 在您的第一个模板添加<xsl:with-param name="file-list" value="$file-list"/>xsl:apply-templates实际传递参数,并
  2. 添加<xsl:param name="file-list"/>你的第二个模板在那里引入参数。