分层标签关闭 [英] Hierarchical tag closing
本文介绍了分层标签关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想以分层方式关闭标签.
这是我的意见.
Hi,
I want close the tags in hierarchical way.
This is my input.
<P_Normal><list-bull></P_Normal>
<P_list-bull(1)>Use Microsoft Windows accessibility </P_list-bull(1)>
<P_list-simple(2)> Magnify the display </P_list-simple(2)>
<P_list-simple(2)> Change the size of text and icons </P_list-simple(2)>
<P_list-simple(2)> Convert the text displayed </P_list-simple(2)>
<P_list-simple(2)> Change the contrast </P_list-simple(2)>
<P_list-simple(2)> Display an onscreen keyboard </P_list-simple(2)>
<P_list-simple(2)> Convert the mouse for left-handed use. </P_list-simple(2)>
<P_list-bull(1)>Deliver learning through </P_list-bull(1)>
<P_list-bull(1)>Increase the character size on handouts for visually impaired learners. </P_list-bull(1)>
<P_list-bull(1)>Adjust background colours and fonts to assist dyslexic learners. </P_list-bull(1)>
<P_list-bull(1)><pg>13</pg>Provide feedback on written work using the comments facility and track changes rather than handwritten notes, so that the learners can change character size or use a text to speech application to hear feedback. </P_list-bull(1)>
</list-bull>
我想以分层方式(以下方式)关闭列表标签
I want to close the list tags in hierarchical manner(below way)
<list list-type="bullet">
<list-item><p>Use Microsoft Windows accessibility options to:
<list list-type="simple">
<list-item><p> Magnify the display</p></list-item>
<list-item><p> Change the size of text and icons</p></list-item>
<list-item><p> Convert the text displayed into speech (i.e. narrator)</p></list-item>
<list-item><p> Change the contrast</p></list-item>
<list-item><p> Display an onscreen keyboard</p></list-item>
<list-item><p> Convert the mouse for left-handed use.</p></list-item>
</list></p></list-item>
<list-item><p>Deliver learning through </p></list-item>
<list-item><p>Increase the character </p></list-item>
<list-item><p> fonts to assist dyslexic learners.</p></list-item>
<list-item><p> Adjust background colours</p></list-item>
</list></p>
请帮我.谢谢.
Please help me. Thank you.
推荐答案
XSLT的经典应用:XML到XML.
Classical application of XSLT: XML to XML.
由于我的解决方案1并不适用(标签不符合XML),请在Perl中找到替代版本.
干杯
安迪
Since my Solution 1 is not really applicable (the tags are not XML conformant), enclosed please find an alternative version in Perl.
Cheers
Andi
#!perl
use strict;
# file: { line NEWLINE } .
# line: listitem | ANY_CHAR .
# listitem: begin itemtext end .
# begin: '<' tag '>' .
# end: '<' '/' tag '>' .
# tag: 'P_list-' kind '(' level ')' .
# itemtext: { ANY_CHAR_EXCEPT_NEWLINE } .
my
data = readfile(shift); 我
data = readfile(shift); my
这篇关于分层标签关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文