0

I have multiple addresses under de addresses node.

This provides me a correct result <xsl:value-of select="customer/addresses/address[entity_id=3282]/city" />

It returns the city of the address node for which address/entity_id=3282

The problem is that the value 3282 is not fixed. The value 3282 is stored in another node /customer/default_shipping

I tried the below but it is not working:

<xsl:variable name="default_shipping"><xsl:value-of select="customer/default_shipping" /></xsl:variable> <xsl:value-of select="customer/addresses/address[entity_id=@default_shipping]/city" />

The @default-shippign is not interpreted in the node. What is the trick?

1
  • I would suggest you use a key to resolve cross-references. Commented Jun 22, 2020 at 14:28

1 Answer 1

1

You could use simply:

<xsl:value-of select="customer/addresses/address[entity_id=customer/default_shipping]/city" />

Or if you want to use a variable:

<xsl:variable name="default_shipping" select="customer/default_shipping"/>
<xsl:value-of select="customer/addresses/address[entity_id=$default_shipping]/city" />
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.