glencarrot
New Member
The idea is:[*]Get variable at parent element \[code\]PurchaseOrder\[/code\][*]Copy all its elements[*]Apply template to child element \[code\]PurchaseOrder/PurchaseOrderLine\[/code\][*]Add element \[code\]<LineNumber>\[/code\] and then copy everything elseI can do part #4 but I can't copy everything in the parent element PurchaseOrder\[code\]<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.openapplications.org/oagis/9"> <!-- STICKER INFO COMBINETOOUTPUT--> <xsl:template match="/"> <xsl:apply-templates select="child::node()/*[name()!='DbResponse']"/> </xsl:template> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="*urchaseOrder"> <TEST>TEEEEEEEST</TEST> <xsl:variable name="WeaNr" select="*urchaseOrderHeader/*ocumentID/*:ID"/> <WEANR><xsl:value-of select="$WeaNr"/></WEANR> <xsl:apply-templates select="*urchaseOrderLine"/> </xsl:template> <xsl:template match="*urchaseOrder/*urchaseOrderLine"> <xsl:variable name="ArtNr" select="*:Item/*:CustomerItemID/*:ID"/> <xsl:variable name="WepNr" select="/*/DbResponse/ResultSet/Row[Cell[@name='ARTNR']=$ArtNr]/Cell[@name='WEPNR']"/> <ARTNR><xsl:value-of select="$ArtNr"/></ARTNR> <WEPNR><xsl:value-of select="$WepNr"/></WEPNR> <xsl:copy> <xsl:if test="$WepNr!=''"> <LineNumber><xsl:value-of select="$WepNr"/></LineNumber> </xsl:if> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template></xsl:stylesheet>\[/code\]