从xml文件获取wsdl值

从xml文件获取wsdl值,xml,wsdl,Xml,Wsdl,我有以下xml文件: <properties> <type>1</type> <!-- 1 or 2> <prop1> test </prop1> <prop2> test2 </prop2> </properties> 1我有一种XSL方法应该适合您 XML文件: <?xml version="1.0" encoding="utf-8"?> <?xml

我有以下xml文件:

<properties>
  <type>1</type> <!-- 1 or 2>

  <prop1> test </prop1>
  <prop2> test2 </prop2>
</properties>


1我有一种XSL方法应该适合您

XML文件:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="YourFile.xslt"?>

<properties>
  <type>1</type> <!-- 1 or 2>-->
  <prop1> test </prop1>
  <prop2> test2 </prop2>
</properties>

1.
测验
测试2
XSLT文件:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="/">
    <xsl:element name="definitions">
      <xsl:element name="xmlProp">
        <xsl:choose>
          <xsl:when test="/properties[type = 1]">
            <xsl:value-of select="/properties/prop1" />
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="/properties/prop2" />
          </xsl:otherwise>
        </xsl:choose>
      </xsl:element>
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>

输出:

<?xml version="1.0" encoding="utf-8"?>
<definitions>
  <xmlProp> test </xmlProp>
</definitions>

测验
我希望这有帮助

<?xml version="1.0" encoding="utf-8"?>
<definitions>
  <xmlProp> test </xmlProp>
</definitions>