[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Mapping from two sources
sudheshna iyer wrote:
Thank you for your answers. It might simply be a problem of use the same spelling and case for element names in the input and the stylesheet (i.e. POOrderLine and not POOrderline) so try <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs"> <xsl:output method="xml" indent="yes"/> <xsl:variable name="doc1" select="/"/> <xsl:param name="doc2Url" as="xs:string" select="'input2.xml'"/> <xsl:variable name="doc2" select="doc($doc2Url)"/> <xsl:template match="/"> <OrderResponse> <xsl:for-each-group select="$doc1//OrderLine, $doc2//POOrderLine" group-by="OLN"> <Oline> <OLN><xsl:value-of select="current-grouping-key()"/></OLN> <xsl:copy-of select="current-group()/(Fname, ID)"/> </Oline> </xsl:for-each-group> </OrderResponse> </xsl:template> </xsl:stylesheet> and then with your above samples you get <OrderResponse> <Oline> <OLN>1</OLN> <Fname>aa</Fname> <ID>123</ID> </Oline> <Oline> <OLN>2</OLN> <Fname>bb</Fname> <ID>324</ID> </Oline> <Oline> <OLN>3</OLN> <ID>456</ID> </Oline> </OrderResponse> -- Martin Honnen http://msmvps.com/blogs/martin_honnen/
|
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
|