[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: change xslt processing order

Subject: Re: change xslt processing order
From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 3 Oct 2011 05:19:39 -0400
Re:  change xslt processing order
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.