Subject: Re: [xsl] change xslt processing order From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx> Date: Mon, 3 Oct 2011 05:19:39 -0400 |
Ken's code was based on a different understanding of the semantics of your input, so I'd actually suggest going back to the code you initially posted and just wrap an <xsl:if> around the two <xsl:apply-templates> instructions in the "Parcel" template. The "test" on the <xsl:if> would be "not(following-sibling::*[1][self::Parcel])". This would output the DeliveryAddress and Consignment after a Parcel only if it was not immediately followed by another Parcel. -Brandon :) On Sun, Oct 2, 2011 at 6:43 AM, Navin Patel <navin98@xxxxxxxxx> wrote: > Ken, > > Can I tweak your xsl to get my desired output shown below or do I need > to use the grouping method, > > Thanks > > Navin > > Expected out: > JD0002210800004322 > 7255 > 044375530 > JD0002210800004323 > 7256 > 044375531 > JD0002210800004324 > JD0002210800004325 > 7257 > 044375532 > > > <?xml version="1.0" encoding="ISO-8859-1"?> > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";> > <xsl:output method='text'/> > > > <xsl:key name="parcelDetailsForAddress" match="DeliveryAddress" > use="following-sibling::Parcel[1]/@PARCEL_NO"/> > <xsl:key name="parcelDetailsForConsignment" match="Consignment" > use="following-sibling::Parcel[1]/@PARCEL_NO"/> > > > <xsl:variable name='newline'> > <xsl:text> > </xsl:text> > </xsl:variable> > <xsl:template match="MR23030B"> > <xsl:apply-templates select="Parcel"/> > </xsl:template> > > > <xsl:template match="Parcel"> > <xsl:value-of select="@PARCEL_NO"/> > <xsl:value-of select="$newline"/> > <xsl:apply-templates select="key('parcelDetailsForAddress',@PARCEL_NO)"/> > <xsl:apply-templates select="key('parcelDetailsForConsignment',@PARCEL_NO)"/> > </xsl:template> > > > <xsl:template match="DeliveryAddress"> > <xsl:value-of select="@BRANCH_CODE"/> > <xsl:value-of select="$newline"/> > </xsl:template> > > > <xsl:template match="Consignment"> > <xsl:value-of select="@ACNT_NO"/> > <xsl:value-of select="$newline"/> > </xsl:template> > > > </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] change xslt processing or, Navin Patel | Thread | Re: [xsl] change xslt processing or, Navin Patel |
Re: [xsl] Can this hard-coded templ, G. Ken Holman | Date | Re: [xsl] how to trigger a new page, team wise |
Month |