0
votes

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.michael.hor257k

1 Answers

1
votes

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" />