Subject: [xsl] change xslt processing order From: Navin Patel <navin98@xxxxxxxxx> Date: Mon, 26 Sep 2011 20:55:37 +0100 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Hash / Translation Tables, Andrew Welch | Thread | Re: [xsl] change xslt processing or, G. Ken Holman |
Re: [xsl] Hash / Translation Tables, Andrew Welch | Date | Re: [xsl] change xslt processing or, G. Ken Holman |
Month |