省略XSLT中的某些元素

时间:2016-08-18 14:36:08

标签: xml xslt

我的团队为我的XML输入分配了一个项目来创建一个XSLT,输入包含多个通知,因此我假设我必须为每个注册通知执行选择。我只想显示XML的以下值并省略其余部分。

通知型

消费者名称

帐单帐户号

我做了一个测试XSLT,它只是省略了我希望构建的消费者电子邮件地址,但是当我运行它时,它输出整个XML,包括消费者电子邮件地址。

无论如何,我能做到这一点吗?

示例XML

<biller-enrollment-notification xmlns="http://sometest.com">
<business-id>0123456</business-id> 
<file-create-date>2016-08-03</file-create-date> 
<enrollment-notification>
<notification-type>ENROLLMENT ADDED</notification-type> 
<consumer-profile-id>5078109</consumer-profile-id> 
<last-update-date>2016-08-02T18:34:37</last-update-date> 
<notification-user-profile>
<primary-email-address>test@test.cm</primary-email-address> 
</notification-user-profile>
</enrollment-notification>
<enrollment-notification>
<notification-type>ENROLLMENT ADDED</notification-type> 
<consumer-profile-id>5078180</consumer-profile-id> 
<last-update-date>2016-08-02T18:50:17</last-update-date> 
<notification-user-profile>
<primary-email-address>test@test.com</primary-email-address> 
</notification-user-profile>
</enrollment-notification>
<enrollment-notification>
<notification-type>ENROLLMENT ADDED</notification-type> 
<consumer-profile-id>5078464</consumer-profile-id> 
<last-update-date>2016-08-02T19:58:47</last-update-date> 
<notification-user-profile>
<primary-email-address>test@test.com</primary-email-address> 
</notification-user-profile>
</enrollment-notification>
<enrollment-notification>
<notification-type>BILLING ADDED</notification-type> 
<consumer-profile-id>5078180</consumer-profile-id> 
<last-update-date>2016-08-02T18:50:17</last-update-date> 
<notification-billing-account>
<billing-account-number>0123456789</billing-account-number> 
</notification-billing-account>
</enrollment-notification> 

测试XSLT

<?xml version="1.0" encoding="UTF-8" ?>

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

<xsl:output method="text" indent="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="primary-email-address"/>

</xsl:stylesheet>

0 个答案:

没有答案