首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何通过XSL在XML文件中添加分层标签?

问如何通过XSL在XML文件中添加分层标签?
EN

Stack Overflow用户
提问于 2010-04-15 18:40:37
回答 2查看 108关注 0票数 0

我在XML转换中遇到了一个问题。XML标记层次结构如下:

代码语言:javascript
复制
<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_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>
</PickSlipList>

我的要求是在页眉的每一页上打印提货单编号。由于<Pick_Slips_Detail_Lines_S3>和<Header_Custom_Section_S15>没有父标签,所以我在打印时遇到了这个问题。

我正在尝试在XML转换中搜索一些东西。但是我不知道如何转换XML标记层次结构。

EN

回答 2

Stack Overflow用户

发布于 2010-04-17 14:30:52

是这样的吗:

代码语言:javascript
复制
<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>

所有的XML输入?这不是格式良好的XML;我认为您不会让XSL引擎将其作为输入。在对数据进行任何转换之前,您可能必须对数据进行预处理。更好的做法是,首先修改创建坏XML的系统部分。

票数 0
EN

Stack Overflow用户

发布于 2010-04-19 16:58:43

格式化后的XML为:- LGT00003 Print Pick 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时间-P I C K S L I P页-1重印-3日期- 2010-04-12拉法基R42520 13:30:39时间-P I C K S L I P页-1重印-4日期- 2010-04-12拉法基R42520 13:30:39时间-P I C K S L I P页-1重印--1 760挑库单#客户编号100809发货至100810因此05_LOY_DO_C_D 00010发货对象:销售对象: 05_LOY_DO_C_D订单编号10000304 1相关P.O. Hasti Co-Op.Indl。*/客户项目编号地点/批次时间扩展金额行<__ Revision _ID22>/版本已发运的延交单位价格12.5 x 1200 x2400 SE标准。100810 72641 1.000 1.0000 SH 0 72641 -04-12 8.5000 8.50 GB20100 2.8800 M2双UOM双发货0每0.00 .00相关订单号SO 0.0000发货编号13603发货地址联系发货地址Y 72641 1 1 1 N 100810 GB20100 Y 0 .0240 00010 10000304原始订单号/类型原始发票编号/类型原因代码-1 12.5 x 1200 x2400 SE标准100810 72801 2.000 2.0000 SH 0 2010-04-12 8.5000 17.00 GB20100 .0778 M2双单位发货0每0.00 .00相关订单编号发货编号13603发货编号13603发货地址联系发货地点Y 72801 1 1 1 N 100810GB20100 Y Y 0 .0480 00010 10000304原始订单号/类型原始发票号/类型原因代码-1 12.5x1200 x2400 SE标准版100810 72801 3.000 3.0000 PL 02010-04-12 8.5000 1836.00 GB20100 8.4000 M2双UOM双发货0每0.00个.00相关订单号发货编号13603板发货编号0.0000联系收货方注意事项Y 72801 1 1 1 N 100810 GB20100 Y Y 0 00010 00010 10000304原始订单号/类型原始发票编号/类型原因代码--1驱动程序签名客户签名可发货重量合计订单销售税<__Final___ID4>Final 1861.50 Tax Rt -2761挑库单#客户编号100809收货方100810 SO 05_LOY_DO_C_D 00010收货人:售货人: 05_LOY_DO_C_D Order Number 10000305 1相关P.O. Hasti Co-Op.Indl。*/客户项目编号地点/批次时间扩展金额行<__ Revision _ID22>/版本已发运的延交单位价格12.5 x 1200 x2400 SE标准。100810 72641 72641 13604 13604 PL 02010-04-12 612.00 GB20100 207.3600 M2双UOM双UOM发货0每0.00 .00相关订单号SO 0.0000发货编号13604发货地址联系发货地址Y 72641 1 1 1 N 100810 GB20100 Y 0 00010 10000305原始订单号/类型原始发票编号/类型原因代码-2 12.5 x 1200 x2400 SE标准100810 72801 2.000 2.0000 SH 0 2010-04-12 8.5000 17.00 GB20100 .0778 M2双单位发货0每0.00个.00相关订单编号发货编号13604发货编号13604发货地址联系发货地点Y 72801 1 1 1 N 100810GB20100 Y Y 0 .0480 00010 10000305原始订单号/类型原始发票号/类型原因代码-2消防检查板标准100810 72803 3.000 3.0000 SH 0 2010-04-12 9.7100 29.13 GB20100 .1100 M2双单位发货0因此每0.00个.00相关订单号0.0000发货编号13604发货至联系发货地点请注意Y 72803 1 1 1 N 100810 GB20100 Y Y 0 .0960 00010 10000305原始订单号/类型Ori

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2644514

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档