Search code examples
xmlperlgroupingxml-libxml

Expanding/collapsing or grouping the same lines in XML


As I know in some programs or in HTML webpages, they use benefit of plus/minus sing +/- that does the job collapsing/grouping.

I'm creating xml file using Perl and there are some identical lines/links which I want to group all such lines.

I am wondering if anyone could please help me in this issue. Thanks in advance!!


Solution

  • The +/- you see in web pages is NOTHING to do with the perl or the source XML. They're the result of the web client applying a default style sheet to the XML, which builds in this functionality.

    You can write your own style sheet if you choose - but this too isn't really anything to do with perl either.

    You can add:

    <?xml-stylesheet type="text/xsl" href="styles_for_this_xml.xsl"?>
    

    To your XML headers. This is written in XSL. There are some examples of 'defaults' in your web browser to be found here: Default XML stylesheet in Chrome?