Subject: Re: [xsl] Mapping from two sources From: sudheshna iyer <sudheshnaiyer@xxxxxxxxx> Date: Sun, 3 Oct 2010 04:37:26 -0700 (PDT) |
Thank you for your answers. But the solution returns only elements from Doc1, I need element of Doc2 if doc1.OLN = doc2.OLN ======== Problem I need to have two sources: input1 and input2. input1: <?xml version="1.0" encoding="ISO-8859-1"?> <Order> <OrderLine> <OLN>1</OLN> <Fname>aa</Fname> </OrderLine> <OrderLine> <OLN>2</OLN> <Fname>bb</Fname> </OrderLine> </Order> input2: <?xml version="1.0" encoding="ISO-8859-1"?> <POOrder> <POOrderLine> <OLN>1</OLN> <ID>123</ID> <LName>aa</LName> </POOrderLine> <POOrderLine> <OLN>2</OLN> <ID>324</ID> <LName>bb</LName> </POOrderLine> <POOrderLine> <OLN>3</OLN> <ID>456</ID> <LName>bb</LName> </POOrderLine> </POOrder> I need the output from both sources combined. Please note that first two elements are coming from input1 and thrid element is from input2. What is the optimal way of doing this? <?xml version="1.0" encoding="ISO-8859-1"?> <OrderResponse> <Oline> <OLN>1</OLN> <Fname>aa</Fname> <ID>123</ID> </Oline> <Oline> <OLN>2</OLN> <Fname>bb</Fname> <ID>324</ID> </Oline> </OrderResponse> ===== Solution proposed: <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> --- On Sat, 10/2/10, Mukul Gandhi <gandhi.mukul@xxxxxxxxx> wrote: > From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx> > Subject: Re: [xsl] Mapping from two sources > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Date: Saturday, October 2, 2010, 1:07 PM > On Sat, Oct 2, 2010 at 4:29 PM, > sudheshna iyer <sudheshnaiyer@xxxxxxxxx> > wrote: > > does xsl:for-each-group acts like inner join? > > Well I think, for-each-group cannot be treated as inner > join (which is > a relational algebra abstraction, as Mike also says) -- we > are not > joining any two sets with for-each-group. The input to > for-each-group > is just a sequence, with definition of grouping key (for > e.g, the > value of group-by attribute). > > I would imagine for-each-group as a kind of mapping > function, > something similar to for-each but with a kind of layer of > grouping on > top of that. > > > > -- > Regards, > Mukul Gandhi > > --~------------------------------------------------------------------ > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ > or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx> > --~--
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Mapping from two sources, Mukul Gandhi | Thread | Re: [xsl] Mapping from two sources, Martin Honnen |
Re: [xsl] How do I determine that a, David Carlisle | Date | Re: [xsl] Mapping from two sources, Martin Honnen |
Month |