0

我需要知道如何在 Oracle SOA BPEL/XSLT Version12c 中修改以下内容。我在基于架构的正确定义的变量中有以下 xsl

<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
  <book>
    <country>America</country>        
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>
      <cost>50</cost>
      <tax>50</tax>
    </price>
  </book>
  <book>
    <country>Aus</country>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>
      <cost>100</cost>
      <tax>10</tax>
    </price>
  </book>
</bookstore>

我只需要更改国家/地区 AUS 的税率,如下所示

<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
  <book>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
  </book>
  <book>
    <country>Aus</country>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>
      <cost>100</cost>
      <tax>50</tax>
    </price>
  </book>
</bookstore>

任何人都可以帮助我如何在 oracle BPEl 或 XSLT 中更改子字段值

4

1 回答 1

1

有很多方法可以做到这一点。但是,这行得通。

  <xsl:template match="book[country = 'Aus']/price/tax">
    <xsl:copy>
      <xsl:value-of select="50"/>
    </xsl:copy>
  </xsl:template>

  <!-- Identity -->
  <xsl:template match="node()|@*">
    <xsl:copy>
      <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
  </xsl:template>
于 2021-07-29T18:32:13.093 回答