XSL for-each call template on nodes with specific value

fukinmad

New Member
Having a XML-structure like this:\[code\]<ContextDoc> <PurchaseOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <OrderForms> <OrderForm> <Shipments> <Shipment> ... <ShippingMethodId>17995798-a2cc-43ad-81e8-bb932f6827e4</ShippingMethodId> ... </Shipment> <Shipment> ... <ShippingMethodId>11223344-a2cc-11bc-25a7-aa345f6827e6</ShippingMethodId> ... </Shipment> </Shipments> <LineItems> <LineItem> ... <ShippingMethodId>17995798-a2cc-43ad-81e8-bb932f6827e4</ShippingMethodId> ... </LineItem> <LineItem> ... <ShippingMethodId>17995798-a2cc-43ad-81e8-bb932f6827e4</ShippingMethodId> ... </LineItem> <LineItem> ... <ShippingMethodId>11223344-a2cc-11bc-25a7-aa345f6827e6</ShippingMethodId> ... </LineItem> </LineItems> </OrderForm> </OrderForms> </PurchaseOrder></ContextDoc>\[/code\]From the template matching each Shipment node I want to loop the LineItems with the current ShippingMethodId. Like so:\[code\]<xsl:template match="Shipment"> <xsl:for-each select="//LineItems/LineItem[ShippingMethodId=./ShippingMethodId]"> <xsl:call-template name="LineItem"> </xsl:call-template> </xsl:for-each></xsl:Template>\[/code\]But that gives me all LineItems under each Shipment. What is the correct way to call the template for the specific LineItem nodes?
 
Back
Top