如何在不知道元素名称的情况下获取 xslt 中节点的子元素?

How to get the child element of a node in xslt without know element name?

我正在使用 WSO2 BPS 3.2.0,我想获取节点的子元素。问题是我在设计时不知道子元素名称。

我有XML个数据

<Object>
    <document xmlns="http://schemas.org/doc/1.1">
        <type>...</type>
        <date>...</date>
    </document>
</Object>

<Object>
    <formular xmlns="http://schemas.org/doc/1.1">
        <formType>...</formType>
        <user>...</user>
    </formular>
</Object>

节点 <Object> 可以有任何 XML

我想剃掉对象 "envelope" 和 return 内部 XML。如何通过 XSLT 解决这个问题?

提前致谢。

您可以使用*来匹配任何元素:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/Object">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="*">
  <xsl:copy><xsl:apply-templates/></xsl:copy>
</xsl:template>