0

I'm formatting a Shopify output XML file and need to select the first-name field, however they have multiple, nested, first-name fields. How do I go about selecting one?

<order>
    <billing-address type="Address">
        <first-name>Bob</first-name>
        <last-name>Biller</last-name>
    </billing-address>
    <shipping-address type="Address">
        <first-name>Steve</first-name><!-- Trying to select shipping-address >> first-name -->
        <last-name>Shipper</last-name>
    </shipping-address>
</order>
4

2 回答 2

0

不确定您为此使用的模板,但例如,如果您有一个与整个订单匹配的模板:

<xsl:template match="order">  
  First name: <xsl:value-of select="shipping-address/first-name"/>
  Last name: <xsl:value-of select="shipping-address/last-name"/>
</xsl:template>

有结果

First name: Steve
Last name: Shipper
于 2014-12-29T21:29:20.537 回答
0

您知道 Shopify 正在为所有 API 工作和 webhook 取消 XML 的输出吗?

于 2014-12-29T22:15:47.117 回答