If you want your templates to be atomic (isolated and reusable), you must reference the parent node in this way. Instead, when invoking the template, pass the link that you want to use. This way you can use this template for the same node type, even if it has a different context / parent (so far you can still load the parameter).
<xsl:template match="PurchaseOrder"> <xsl:apply-templates select="PurchaseOrderLine"> <xsl:with-param name="PurchaseOrder" select="."/> </xsl:apply-templates> </xsl:template> <xsl:template match="PurchaseOrderLine"> <xsl:param name="PurchaseOrder"/> </xsl:template>
Now in your PurchaseOrderLine template, you can reference the $ PurchaseOrder variable.
rainabba
source share