Subject: Re: [xsl] how to make a log file in XSLT? From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sun, 12 Mar 2023 20:15:20 -0000 |
On 3/12/2023 9:11 PM, Jean-Luc Chevillard jeanluc.chevillard@xxxxxxxxx wrote:
Dear list members,become
I have been wondering for a long time whether there was a method for automatically recording some elements of information every time I run a given script.
As a minimum example, I would start with an empty file +++++++++++++++ <?xml version="1.0" encoding="UTF-8"?> <log> </log> +++++++++++++++++++++++
After running the script once, the file would become +++++++++++++++ <?xml version="1.0" encoding="UTF-8"?> <log> <entry>[2023-03-12 (19:53)]</entry> </log> +++++++++++++++++++++++
After running the script a second time, one hour later, the file would
+++++++++++++++ <?xml version="1.0" encoding="UTF-8"?> <log> <entry>[2023-03-12 (20:53)]</entry> <entry>[2023-03-12 (19:53)]</entry> </log> +++++++++++++++++++++++
I have just tried doing this by applying the script at the bottom of this message (in which "copy.xslt" is the identity transform) to a base file, but as I expected, I obtained an error message stating:
System ID: C:\JLC\XML_tests\cEnAvaraiyam\log_book_experiment.xslt Scenario: 4a_log_experiment XML file: C:\JLC\XML_tests\cEnAvaraiyam\cEnA_MSS_rectangles_chart.xml XSL file: C:\JLC\XML_tests\cEnAvaraiyam\log_book_experiment.xslt Engine name: Saxon-PE 11.4 Severity: fatal Problem ID: XTRE1500 Description: Cannot read a document that was written during the same transformation: file:/C:/JLC/XML_tests/cEnAvaraiyam/experimental_log_book.xml Start location: 17:63 Length: 1 URL: http://www.w3.org/TR/xslt20/#err-XTRE1500
Is there a method for obtaining the desired result by using XSLT?
In some context I think you can fool Saxon by using different URIs e.g. append some query string to the input URI
<xsl:variable name="current_log_content" select="document($Log_file_name || '?foo=bar')"/>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] how to make a log file in XSL, Jean-Luc Chevillard | Thread | Re: [xsl] how to make a log file in, Michael Kay michaelk |
[xsl] how to make a log file in XSL, Jean-Luc Chevillard | Date | Re: [xsl] how to make a log file in, Michael Kay mike@xxx |
Month |