XSLT xsl:sequence. What is it good for..?

后端 未结 4 612
北恋
北恋 2020-12-24 05:28

I know the following question is a little bit of beginners but I need your help to understand a basic concept.

I would like to say first that I\'m a XSLT programmer

4条回答
  •  [愿得一人]
    2020-12-24 06:15

    Another use is to create a tag only if it has a child. An example is required :

    
        node b
        node c
    
    

    Somewhere in your XSLT :

    
        Got a "b" node
        Got a "c" node
    
    
        
    
    

    You may see the demo here : http://xsltransform.net/eiZQaFz

    It is way better than testing each tag like this :

    ...
    

    Because you would end up editing it in two places. Also the processing speed would depend on which tags are in your imput. If it is the last one from your test, the engine will test the presence of everyone before. As $foo/node() is an idioms for "is there a child element ?", the engine can optimize it. Doing so, you ease the life of everyone.

提交回复
热议问题