[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Clarify Add an element to the result xml document
To clarify what I need. This is source XML: <Order> <OrderHeader> <OrderNumber> <BuyerOrderNumber>3</BuyerOrderNumber> <SellerOrderNumber/> <ListOfMessageID> <!-- one MessageID element --> <MessageID> <IDNumber/> <IDAssignedBy> <IDAssignedByCoded/> <IDAssignedByCodedOther/> </IDAssignedBy> <IDAssignedDate/> </MessageID> </ListOfMessageID> </OrderNumber> This is what I need the result to look like: <Order> <OrderHeader> <OrderNumber> <BuyerOrderNumber>3</BuyerOrderNumber> <SellerOrderNumber/> <ListOfMessageID> <!-- nested MessageID elements --> <MessageID> <MessageID> <IDNumber/> <IDAssignedBy> <IDAssignedByCoded/> <IDAssignedByCodedOther/> </IDAssignedBy> <IDAssignedDate/> </MessageID> </MessageID> </ListOfMessageID> </OrderNumber> The Solution from Michael Kay that follows duplicated the MessageID and children: <xsl:template match="MessageID"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> <!-- and again... --> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> The Solutions from Joerg adds a <MessageID/> element in place of the child elements: <xsl:template match="MessageID"> <xsl:copy> <xsl:copy> </xsl:copy> </xsl:copy> </xsl:template> The burning question is why do I want this. We receive E-Procurement orders in xCBL, cXML, etc. We set up mapping in NetFish to our order response and back-end. When we start a new element map in NetFish (now Iona E2A Integrator) we repeat element tags to show repeating groups of elements. Thanks again for your help - I have tried so many ways to solve this without manually adding the tags. Lynda Lynda Van Vleet E-Procurement Technical Specialist Newark Electronics 4801 North Ravenswood Avenue Chicago IL 60640-4496 773 907 5919 LVanVleet@xxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|