我正在尝试从 XML 文档中选择一个企业的位置集合。此代码有效,但仅选择一项。所以,我的问题是:我可以对这段代码做些什么来使它适用于每个位置?
<xsl:template match="/InstitutionAlias/InstitutionAliasExternalReferenceCollection">
<InstitutionExternalReferenceCollection>
<xsl:for-each select="InstitutionAliasExternalReference">
<InstitutionExternalReference>
<ExternalReferenceIdentifier>
<xsl:value-of select="ExternalReferenceIdentifier"/>
</ExternalReferenceIdentifier>
</InstitutionExternalReference>
</xsl:for-each>
</InstitutionExternalReferenceCollection>
</xsl:template>
这就是输出的样子
<InstitutionExternalReferenceCollection>
- <InstitutionExternalReference>
<ExternalReferenceIdentifier>Test1</ExternalReferenceIdentifier>
</InstitutionExternalReference>
- <InstitutionExternalReference>
<ExternalReferenceIdentifier>Test2</ExternalReferenceIdentifier>
</InstitutionExternalReference>
这是一个示例 xml 文件。
- <InstitutionAliasExternalReferenceCollection>
- <InstitutionAliasExternalReference>
<ExternalReferenceIdentifier>Test1</ExternalReferenceIdentifier>
</InstitutionAliasExternalReference>
- <InstitutionAliasExternalReference>
<ExternalReferenceIdentifier>Test2</ExternalReferenceIdentifier>
</InstitutionAliasExternalReference>