开发者

How to add a hierarchical tag in an XML file though XSL?

I am facing a problem in XML transformation. The XML tag hierarchy is as follows:

<Pick_Slips_Detail_Lines_S3>
<Header_Custom_Section_S15>
//This tag contains the header data (Example:Pick Slip Number)
</Header_Custom_Section_S15>
Then the Detail lines are printed.
</Pick_Slips_Detail_Lines_S3>

<Pick_Slips_Detail_Lines_S3>
The detail lines are printed. This detail line belongs to the previous Pick Slip Number.
</Pick_Slips_Detail_Lines_S3>

<Pick_Slips_Detail_Lines_S3>
The detail lines are printed. This detail line belongs to the previous Pick Slip Number.
</Pick_Slips_Detail_Lines_S3>

My requirement is to:
<PickSlipList>
<Pick_Slips_Detail_Lines_S3>
<Header_Custom_Section_S15>
//This tag contains the header data (Example:Pick Slip Number)
</Header_Custom_Section_S15>
Then the Detail lines are printed.
</Pick_Slip开发者_运维技巧s_Detail_Lines_S3>

<Pick_Slips_Detail_Lines_S3>
The detail lines are printed. This detail line belongs to the previous Pick Slip Number.
</Pick_Slips_Detail_Lines_S3>

<Pick_Slips_Detail_Lines_S3>
The detail lines are printed. This detail line belongs to the previous Pick Slip Number.
</Pick_Slips_Detail_Lines_S3>
</PickSlipList>

My requirement is to print the Pick Slip Number at every page on the header. Since there is no parent tag for <Pick_Slips_Detail_Lines_S3> and <Header_Custom_Section_S15>, I face the problem while printing.

I am trying to search something in XML transformation. But I don't know how to transform the XML tag hierarchy.


Is this:

<Pick_Slips_Detail_Lines_S3>
<Header_Custom_Section_S15>
//This tag contains the header data (Example:Pick Slip Number)
</Header_Custom_Section_S15>
Then the Detail lines are printed.
</Pick_Slips_Detail_Lines_S3>

<Pick_Slips_Detail_Lines_S3>
The detail lines are printed. This detail line belongs to the previous Pick Slip Number.
</Pick_Slips_Detail_Lines_S3>

<Pick_Slips_Detail_Lines_S3>
The detail lines are printed. This detail line belongs to the previous Pick Slip Number.
</Pick_Slips_Detail_Lines_S3>

all of your XML input? This isn't well formed XML; I don't think you're going to get an XSL engine to take that as input. You will probably have to pre-process the data before you do any transforms to it. Better yet, modify the piece of the system that is creating the bad XML to begin with.


The formatted XML is: - - - LGT00003 Print Pick Slips grpsgh11 grpsgh11 JPY811B NPANDIT *ALL Lafarge E811 12/04/10 13:30:38 - - 1 Date - 2010-04-12 Lafarge R42520 13:30:39 Time - P I C K S L I P Page - 1 REPRINT - 2 Date - 2010-04-12 Lafarge R42520 13:30:39 Time - P I C K S L I P Page - 1 REPRINT - 3 Date - 2010-04-12 Lafarge R42520 13:30:39 Time - P I C K S L I P Page - 1 REPRINT - 4 Date - 2010-04-12 Lafarge R42520 13:30:39 Time - P I C K S L I P Page - 1 REPRINT - - 1 760 Pick Slip # Customer No 100809 Ship To 100810 SO 05_LOY_DO_C_D 00010 Ship To: Sold To: 05_LOY_DO_C_D Order Number 10000304 1 Related P.O. Hasti Co-Op. Indl. Estate JONES INDUSTRIAL ESTATE GB20100 Vyarwali Road , Ting-Tong Avenue Brn/Plt RHYL CH3 1QM Scenic Plaza , Stardom Complex United Kingdom RMA Number Old Baazaar , England RHYL CH3 1QM 00010 United Kingdom GBP Attention: Attention: - 1 Type the Pick slip here - 1 Order Date Driver Must have Photo ID Promised Ship Customer P.O. F.O.B. gdsh 2010-04-12 Inst 2010-04-12 Pick Date/ Description Item No. / Cust. Item No. Location / Lot Time Extended Amount Line <__Revision_ID22>/ Revision Shipped Backordered UOM Price 12.5 x 1200 x2400 SE Standard .. 100810 72641 1.000 1.0000 SH 0 2010-04-12 8.5000 8.50 GB20100 2.8800 M2 Dual UOM Dual Shipped 0 SO 0.0000 Per 0.00 .00 Related Order Number Board Shipment Number 13603 Ship To Contact Ship To Attention Y 72641 1 1 1 1 N 100810 GB20100 Y Y 0 .0240 00010 10000304 Original Order Number/Type Original Invoice Number/Type Reason Code - 1 12.5 x 1200 x2400 SE Standard 100810 72801 2.000 2.0000 SH 0 2010-04-12 8.5000 17.00 GB20100 .0778 M2 Dual UOM Dual Shipped 0 SO 0.0000 Per 0.00 .00 Related Order Number Board Shipment Number 13603 Ship To Contact Ship To Attention Y 72801 1 1 1 1 N 100810 GB20100 Y Y 0 .0480 00010 10000304 Original Order Number/Type Original Invoice Number/Type Reason Code - 1 12.5 x 1200 x2400 SE Standard 100810 72801 3.000 3.0000 PL 0 2010-04-12 8.5000 1836.00 GB20100 8.4000 M2 Dual UOM Dual Shipped 0 SO 0.0000 Per 0.00 .00 Related Order Number Board Shipment Number 13603 Ship To Contact Ship To Attention Y 72801 1 1 1 1 N 100810 GB20100 Y Y 0 5.1840 00010 10000304 Original Order Number/Type Original Invoice Number/Type Reason Code - - 1 Driver Signature Customer Signature Shippable Weight Total Order Sales Tax <__Final___ID4>Final 1861.50 Tax Rt - 2 761 Pick Slip # Customer No 100809 Ship To 100810 SO 05_LOY_DO_C_D 00010 Ship To: Sold To: 05_LOY_DO_C_D Order Number 10000305 1 Related P.O. Hasti Co-Op. Indl. Estate JONES INDUSTRIAL ESTATE GB20100 Vyarwali Road , Ting-Tong Avenue Brn/Plt RHYL CH3 1QM Scenic Plaza , Stardom Complex United Kingdom RMA Number Old Baazaar , England RHYL CH3 1QM 00010 United Kingdom GBP Attention: Attention: - 2 Type the Pick slip here - 2 Order Date Driver Must have Photo ID Promised Ship Customer P.O. F.O.B. 23525 2010-04-12 Inst 2010-04-12 Pick Date/ Description Item No. / Cust. Item No. Location / Lot Time Extended Amount Line <__Revision_ID22>/ Revision Shipped Backordered UOM Price 12.5 x 1200 x2400 SE Standard .. 100810 72641 1.000 1.0000 PL 0 2010-04-12 8.5000 612.00 GB20100 207.3600 M2 Dual UOM Dual Shipped 0 SO 0.0000 Per 0.00 .00 Related Order Number Board Shipment Number 13604 Ship To Contact Ship To Attention Y 72641 1 1 1 1 N 100810 GB20100 Y Y 0 1.7280 00010 10000305 Original Order Number/Type Original Invoice Number/Type Reason Code - 2 12.5 x 1200 x2400 SE Standard 100810 72801 2.000 2.0000 SH 0 2010-04-12 8.5000 17.00 GB20100 .0778 M2 Dual UOM Dual Shipped 0 SO 0.0000 Per 0.00 .00 Related Order Number Board Shipment Number 13604 Ship To Contact Ship To Attention Y 72801 1 1 1 1 N 100810 GB20100 Y Y 0 .0480 00010 10000305 Original Order Number/Type Original Invoice Number/Type Reason Code - 2 Firecheck Board STD 100810 72803 3.000 3.0000 SH 0 2010-04-12 9.7100 29.13 GB20100 .1100 M2 Dual UOM Dual Shipped 0 SO 0.0000 Per 0.00 .00 Related Order Number Shipment Number 13604 Ship To Contact Ship To Attention Y 72803 1 1 1 1 N 100810 GB20100 Y Y 0 .0960 00010 10000305 Original Order Number/Type Ori

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜