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

change xslt processing order

Subject: change xslt processing order
From: Navin Patel <navin98@xxxxxxxxx>
Date: Mon, 26 Sep 2011 20:55:37 +0100
 change xslt processing order
Hi,

I have been trying to solve this problem for a while but I haven't had
much luck.
I  have attached the xml and the xslt file below, My desired output
for the given xml is:

Expected out:
 JD0002210800004322
 7255
 044375530
 JD0002210800004323
 7256
 044375531
 JD0002210800004324
 JD0002210800004325
 7257
 044375532

but I am getting the following output:

 JD0002210800004322
 7255
 044375530
 JD0002210800004323
 7256
 044375531
 JD0002210800004324
 7257
 044375532
 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: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="preceding-sibling::DeliveryAddress[1]"/>
<xsl:apply-templates select="preceding-sibling::Consignment[1]"/>
</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>




XML file :

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="mr23030b.xsl"?>
<MR23030B>
 <Header RECORD_TYPE="HD" METER_NO="10800" FILE_DATE="23/06/2011"
RUN_NUMBER="000909"/>
 <SenderAddress RECORD_TYPE="AS" COUNTRY_CODE="GB" BRANCH_PREFIX=""
BRANCH_CODE=""/>
 <Consignment RECORD_TYPE="CO" ACNT_NO="044375530"
CONT_NO="9360964" COLL_PT="0001"/>
 <DeliveryAddress RECORD_TYPE="AD" COUNTRY_CODE="GB"
BRANCH_PREFIX="07" BRANCH_CODE="7255"/>
 <Parcel RECORD_TYPE="PA" MANIFEST_NO="0000000000"
PARCEL_NO="JD0002210800004322"/>
 <Consignment RECORD_TYPE="CO" ACNT_NO="044375531"
CONT_NO="9360964" COLL_PT="0001"/>
 <DeliveryAddress RECORD_TYPE="AD" COUNTRY_CODE="GB"
BRANCH_PREFIX="07" BRANCH_CODE="7256"/>
 <Parcel RECORD_TYPE="PA" MANIFEST_NO="0000000000"
PARCEL_NO="JD0002210800004323"/>
 <Consignment RECORD_TYPE="CO" ACNT_NO="044375532"
CONT_NO="9360964" COLL_PT="0001"/>
 <DeliveryAddress RECORD_TYPE="AD" COUNTRY_CODE="GB"
BRANCH_PREFIX="07" BRANCH_CODE="7257"/>
 <Parcel RECORD_TYPE="PA" MANIFEST_NO="0000000000"
PARCEL_NO="JD0002210800004324"/>
 <Parcel RECORD_TYPE="PA" MANIFEST_NO="0000000000"
PARCEL_NO="JD0002210800004325"/>
 <TrailerRecord RECORD_TYPE="TR" NO_RECORDS="00000425"/>
</MR23030B>

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.