Logging with XSLT

后端 未结 6 1893
逝去的感伤
逝去的感伤 2021-02-06 02:37

How and where could I output log messages for debug and performance purposes during an XSLT transformation?

I guess the simplest method is using express

6条回答
  •  心在旅途
    2021-02-06 03:07

    This is exactly what is designed for. However, the output location is entirely dependent on the processor. I only have a Mac handy but, sadly, both Firefox and Safari suppress the output. I expect MSIE will do the same.

    Given that, I think your best bet is to use to generate your logs. Something like the below should do the trick:

    
       Entering my-element template
       

    Leaving my-element template

    That would give you something like this in the output:

    
    

    ...

    Clearly, you can put whatever logging you want into that that output. I would consider creating something like the following and using it to run your logging. This references a global param called 'enable-logging' to determine if logging should occur or not.

    
       
       
           
       
    
    

    Use this in your stylesheet as:

    
       
         Entering my-element template
       
       

    Leaving my-element template

    One benefit of doing it this way is you can change that to when in a more complete environment. It is more verbose but more general.

提交回复
热议问题